Hey,
I have found a script for High Score board but it looks like not working, So i made some small changes but still not working.. What does i wrong i cannot found it (It says that there are no "Errors" Non blue lines..
This script going into "ServerScriptService" The "game.Workspace.HighScore.TopBlock.SurfaceGui" is correct into my workspace, Model: HighScore into this: TopBlock into that: SurfaceGui into SurfaceGui: Name1 - Name10 and Score1 - Score10
local ods = game:GetService("DataStoreService"):GetOrderedDataStore("Scores")
function updateBoard(board, data)
for k,v in pairs(data) do
local pos = k
local name = v.key
local score = v.value
local dispname = board:findFirstChild("Name"..pos)
local dispval = board:findFirstChild("Score"..pos)
dispname.Text = tostring(name)
dispval.Text = tostring(score)
end
end
while true do
wait(60) -- Updates every 2 minutes
local pages = ods:GetSortedAsync(false, 10)
local data = pages:GetCurrentPage()
updateBoard(game.Workspace.HighScore.TopBlock.SurfaceGui, data) -- change 'game.Workspace.HighScore.TopBlock.SurfaceGui'
end
This script going into "StarterGui" or "Players" --> Its a local script
wait(5)
local player = game.Players.LocalPlayer
while true do
game.Workspace.UploadScore:InvokeServer()
wait(60)-- How long you want to usend
end
This script going into "Workspace" into this script a have a "RemoteFunction" Named: UploadScore
function script.UploadScore.OnServerInvoke(player)
local inv = player:WaitForChild("leaderstats") -- Whatever stats
local score = game:GetService("DataStoreService"):GetOrderedDataStore("TopScores") -- Name of Data Store
score:SetAsync(player.Name, inv:FindFirstChild("Candy").Value) -- What is in the leaderstats
end
Thank you.
