I want to make a level where if you hit a checkpoint, it puts the counter up by one, but I don't want it so that it happens multiple times. I already set up the the stage variable on the leaderboard, here is the code:
local function onPlayerJoin(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player
local stage = Instance.new("IntValue")
stage.Name = "Stage"
stage.Value = 0
stage.Parent = leaderstats
end
game.Players.PlayerAdded:Connect(onPlayerJoin)
Edit- It only highlighted some of the code as code. from the colon to this is all code
and now I want it so that when you hit a different checkpoint, the number changes. How do I do this?

1 comment
Maybe for each level, you have a spawnpoint, and add a touched script, that connects to a function that adds one point to the players leaderstat?