local Checkpoints = script.Parent
for i,v in pairs(Checkpoints:GetChildren())do
if v:IsA("BasePart")then
v.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid")then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if player.leaderstats.Checkpoints.Value < tonumber(v.Name)then
player.leaderstats.Checkpoints.Value = tonumber(v.Name)
end
end
end
end)
end
end
local Checkpoints = script.Parent
for i,v in pairs(Checkpoints:GetChildren())do
if v:IsA("BasePart")then
v.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid")then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local stats = player:WaitForChild("leaderstats")
if player then
if stats.Checkpoints.Value < tonumber(v.Name)then
stats.Checkpoints.Value = tonumber(v.Name)
end
end
end
end)
end
end
Then that’s probably why, I recommed learning the basics of scripting before you start any project because you’ll not go anywhere just by tutorials, having a grasp of Luau is essential