GameCenter High Score Help

Hi people and community. I need help with GameCenter submitting score my problem is everytime I try to submit a score through a button click it won’t do anything here is what I mean

[code] module(…, package.seeall)

function new()
local localGroup = display.newGroup()

local scores = ice:loadBox( “scores” )
local high3 = scores:retrieve(“best3”)
print(high)
local score = 0
local time = 200
local ui = require(“ui”)

local bkg = display.newImage( “bkg.png” )
bkg.x = 160; bkg.y = 240
localGroup:insert(bkg)

local gameover = display.newText(“Game Over”,0 ,0 ,“Arial”, 30)
gameover.x = 160
gameover.y = 40
gameover:setTextColor( 0,0,0 )
localGroup:insert(gameover)

local highText = display.newText("", 0,0,“Arial”,22)
highText.x = display.contentWidth/2
highText.y = display.contentHeight/3
highText:setTextColor( 0,0,0 )
local highScore = scores:retrieve(“best3”)
if highScore ~= nil then
highText.text = "HighScore: "… scores:retrieve(“best3”)
end

local function show_highScore()
gameOver = not gameOver
scores:storeIfHigher( “best3”, score )
scores:save()
local highText = display.newText("", 0,0,“Arial”,22)
highText.x = display.contentWidth/2
highText.y = display.contentHeight/2
highText:setTextColor( 0,0,0 )
if score > high3 then
if score > scores:retrieve(“best3”) then
highText.text = "New HighScore: "… scores:retrieve(“best3”)
print(“new high score”)
else
highText.text = "New HighScore: "… scores:retrieve(“best3”)
end
end
end
timer.performWithDelay(time, show_highScore, 1)

local function onplay (event)
if loggedIntoGC then gameNetwork.request( “setHighScore”, { localPlayerScore={ category=leaderBoards[currentBoard], value=score }, listener=requestCallback } ); else offlineAlert(); end
if event.phase == “release” then
director:changeScene (“allaround”)

end
end
local function ongameselect (event)
if loggedIntoGC then gameNetwork.request( “setHighScore”, { localPlayerScore={ category=leaderBoards[currentBoard], value=score }, listener=requestCallback } ); else offlineAlert(); end
if event.phase == “release” then
director:changeScene (“play”)
end
end

playagain = ui.newButton{
default = “red1.png”,
over = “red2.png”,
x = 160,
y = 400,
text = “Play Again”,
onEvent = onplay,
}

gameselect = ui.newButton{
default = “red1.png”,
over = “red2.png”,
x = 160,
y = 330,
text = “Game Select”,
onEvent = ongameselect,
}

return localGroup
end [/code]

What I tried to do Is submit the score while changing scene. But I actually don’t know if I’m doing this right.

Help is appreciated thanks :slight_smile: [import]uid: 17058 topic_id: 20760 reply_id: 320760[/import]

I need some help here I’m not understanding GameCenter very well [import]uid: 17058 topic_id: 20760 reply_id: 81683[/import]

It’s really hard to help when we don’t have all the source code.

What does the table leaderBoards contain?
What value is currentBoard?
Is score really a high score for that player?

Is everything in iTunes Connect setup properly?

Where is the function: show_highScoreo
located? What is its contents?

timer.performWithDelay(time, show_highScore, 1)

How do you know its not working? [import]uid: 19626 topic_id: 20760 reply_id: 81700[/import]

Sorry for posting here, but i don’t want to open a new discussion.

My problem is, that i want to display to the player at game over, his place on the highscore list. (best would be knowing it before sending the score to the toplist). Is there any way to calculate this? [import]uid: 88330 topic_id: 20760 reply_id: 127198[/import]

Sorry for posting here, but i don’t want to open a new discussion.

My problem is, that i want to display to the player at game over, his place on the highscore list. (best would be knowing it before sending the score to the toplist). Is there any way to calculate this? [import]uid: 88330 topic_id: 20760 reply_id: 127198[/import]