Ok so I’ve gone back to what you told me to use since you know how to use it so I required it
local GGData = require (“GGData”)
I set the value of it
local highscore = GGData:new()
highscore.anotherValue = 0
I update it and save alongside the score
local function addToScore()
_G.score = _G.score + 1
scorenumber.text = _G.score
transition.moveTo(cookie, {x= math.random(30, 280), y= math.random(-20, 500), time=0})
if (_G.score > highscore.anotherValue) then
highscore.anotherValue = _G.score
highscorenumber.text = highscore.anotherValue
highscore:save()
end
end
but I get an error with this in the GGData file
path = system.pathForFile( self.path … “/” … self.id … “.box”, system.DocumentsDirectory )
local file = io.open( path, “w” )
It says attempt to concatenate field ‘id’ (a nil value)
I also changed the box to highscore but it doesn’t work, since you know how it works do you know what I’m doing wrong?