Can I have help with my leaderboard stats please?
Asked by
2 years ago Edited 2 years ago
Hey, I am creating an obby but I have this problem:
I want the stage leaderboard and the minute leaderboard In the top right of the screen.
The problem is, when I put the minutes leaderboard in Serverscript service, I only have the stage leaderboard who is showing but not the minutes leaderboard and the leaderboard dont update, there a video the to understand my problem:
https://streamable.com/jux3pk
and theres the two scripts:
-the stage leaderboard:
01 | local checkpoints = workspace:WaitForChild( "Checkpoints droite" ) |
02 | local remoteEvent = game.ReplicatedStorage:WaitForChild( "ResetStatEvent" ) |
04 | game.Players.PlayerAdded:Connect( function (player) |
05 | local leaderstats = Instance.new( "Folder" ) |
06 | leaderstats.Name = "leaderstats" |
07 | leaderstats.Parent = player |
09 | local stage = Instance.new( "IntValue" ) |
12 | stage.Parent = leaderstats |
14 | player.CharacterAdded:Connect( function (char) |
15 | local hum = char:WaitForChild( "Humanoid" ) |
17 | char:MoveTo(checkpoints [ stage.Value ] .Position) |
19 | hum.Touched:Connect( function (hit) |
20 | if hit.Parent = = checkpoints then |
21 | if tonumber (hit.Name) = = stage.Value + 1 then |
22 | stage.Value = stage.Value + 1 |
29 | remoteEvent.OnServerEvent:Connect( function (plr) |
30 | if plr and plr.Character and plr.Character:FindFirstChild( "Humanoid" ) then |
31 | local humanoid = plr.Character.Humanoid |
32 | plr.leaderstats.Stage.Value = 0 |
and the minutes leaderboard:
01 | local DataStoreService = game:GetService( "DataStoreService" ) |
02 | local DataStore = DataStoreService:GetDataStore( "TimeStats" ) |
04 | game.Players.PlayerAdded:Connect( function (Player) |
05 | local Leaderstats = Instance.new( "Folder" ) |
06 | Leaderstats.Name = "leaderstats" |
07 | Leaderstats.Parent = Player |
08 | local Minutes = Instance.new( "IntValue" ) |
09 | Minutes.Name = "Minutes" |
11 | Minutes.Parent = Leaderstats |
13 | local Data = DataStore:GetAsync(Player.UserId) |
18 | coroutine.resume(coroutine.create( function () |
21 | Minutes.Value = Minutes.Value + 1 |
26 | game.Players.PlayerRemoving:Connect( function (Player) |
27 | DataStore:SetAsync(Player.UserId, Player.leaderstats.Minutes.Value) |
Thanks in advance!