I am creating a checkpoint system for my obby game but I ran into the problem that if I step on the checkpoint it adds the Value + 1 more than one time. Keep in mind I am a new scripter and I attempted this by myself without watching any videos or any references so don’t get mad if I sound dumb.
-- Level Leaderstats
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Level = Instance.new("IntValue")
Level.Name = "Level"
Level.Value = 0
Level.Parent = leaderstats
local player = game.Players.LocalPlayer
local FirstCheckpoint = game.Workspace.Checkpoints.LevelOneCheckpoint -- Checkpoint
-- Adding Value
FirstCheckpoint.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") then
Level.Value = Level.Value + 1
end
end)
end)