so im trying to make a leaderboard in game on a literal board where you can scroll on and stuff with the most time played of top 100. i have these two scripts but i have no idea how to put it on a leaderboard
function onPlayerEntered(newPlayer)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local captures = Instance.new("IntValue")
captures.Name = "Time Played"
captures.Value = 0
captures.Parent = stats
stats.Parent = newPlayer
wait(1)
captures.Value=captures.Value+1
wait(1)
captures.Value=captures.Value+1
wait(1)
captures.Value=captures.Value+1
workspace.LinkedLeaderboard["Time Playing Counter"]:Clone().Parent=newPlayer.Backpack
workspace.LinkedLeaderboard["Time Playing Counter"]:Clone().Parent=newPlayer.StarterGear
end
game.Players.ChildAdded:connect(onPlayerEntered)
and inside this script the local script:
while wait(1) do
game.Players.LocalPlayer.leaderstats["Time Played"].Value=game.Players.LocalPlayer.leaderstats["Time Played"].Value+1
end
and so im guessing this is for the leaderboard upright, but i want to put it on a literal 3d leaderboard in the game
I’d recommend doing everything on the server-side just because on client-side players can exploit your value and also you can prevent many errors mistakes not seen value increased by the server because you are increasing value in local script.
function onPlayerEntered(newPlayer)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local captures = Instance.new("IntValue")
captures.Name = "Time Played"
captures.Value = 0
captures.Parent = stats
stats.Parent = newPlayer
workspace.LinkedLeaderboard["Time Playing Counter"]:Clone().Parent=newPlayer.Backpack
workspace.LinkedLeaderboard["Time Playing Counter"]:Clone().Parent=newPlayer.StarterGear
end
game.Players.ChildAdded:Connect(onPlayerEntered)
while true do
for i,v in pairs(game:GetService("Players"):GetChildren()) do
v:FindFirstChild("leaderstats")["Time Played"].Value = v:FindFirstChild("leaderstats")["Time Played"].Value + 1
end
wait(1)
end
You have a button in the studio which you can change the look of information from client-side and server side, here is the article. I don’t think you used my script because I don’t have a count to three at the start so that’s maybe the problem you used the other guy’s script or it’s just a mistake in mine source which I don’t really think it is.
okay it works. how do i make sure it actually says time played instead of time… also is it really not possible to put this on a part inside of the actual game