Hi,
I’m trying to compare the score [1] and highscore [1] tables to get the highest score and record it in highscore.json but it does not work for me.
Can somebody help me?
thank.
local function onCollision\_1(event) if event.phase == "began" then local agro = event.object1 local hit = event.object2 if agro.type == "ball" and hit.type == "exit" then elseif agro.type == "exit" and hit.type == "ball" then initialtime.text = initialtime.text + clockText.text score = {} highscore = {} highscore[1] = initialtime.text score[1] = initialtime.text loadsave.saveTable(score, "score.json", system.DocumentsDirectory) score = loadsave.loadTable("score.json", system.DocumentsDirectory) if score[1] \> highscore[1] then loadsave.saveTable(highscore, "highscore.json", system.DocumentsDirectory) highscore = loadsave.loadTable("highscore.json", system.DocumentsDirectory) else end showpoints = function() storyboard.gotoScene("play", "fade", 800) end timer.performWithDelay(2000, showpoints) end end end