Here is my code. It is meant to work as a checkpoint system.
local checkpoint = script.Parent
checkpoint.Touched:Connect(function(otherPart)
local partParent = otherPart.Parent
local hum = partParent:FindFirstChildWhichIsA('Humanoid')
if hum then
local plrName = partParent.Name
local plr = game.Players[plrName]
local stage = checkpoint.Name
if plr.leaderstats.Stage.Value >= stage then
else
plr.leaderstats.StageValue = stage
end
end
end)
