So I got the leaderboard, with the stages, but I don't know what script I should insert for all the checkpoints in my obby to make the stage number increase. Here's my serverscriptservice
game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model") leaderstats.Name = "leaderstats" leaderstats.Parent = player local stage = Instance.new("IntValue") stage.Name = "Stage" stage.Value = 0 stage.Parent = leaderstats end)
If somebody could tell me the script that goes into checkpoints,that would be greatly appreciated
You can add a touch event with a debounce so when the player touches it, it will set it to that.
local debounce = false checkpoint_name.Touched:Connect(function(hit) if debounce == false then if hit.Parent then if hit.Parent:FindFirstChild("Humanoid") then debounce = true local plr = game.Players:GetPlayerFromCharacter(hit.Parent) plr.leaderstats.Stage.Value += 1 local hum = hit.Parent.Humanoid -- as Speedmask said, I did not realise this, but the hum.Died function would infact cause a memory leakage. I have never made obbies before, so this is as far as I can get you. Sorry! end end end -- this should be 'end' not 'end)'. end)
Any mistakes, sorry.
Hope this helps!
There were a few mistakes, and I have fixed them.