alright, I will make the checkpoint value when the player first joins the game. replace the old script with this new one:
for i,v in pairs(workspace.Checkpoints:GetChildren()) do
v.Touched:Connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent) then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
player.Checkpoint.Value = v.Name
end
end)
end
game.Players.PlayerAdded:Connect(function(player)
local Checkpoint = Instance.new("StringValue")
Checkpoint.Name = "Checkpoint"
Checkpoint.Value = "Spawn" --Change this to the spawn checkpoint's name.
Checkpoint.Parent = player
player.CharacterAdded:Connect(function(char)
wait()
local checkpoint = workspace.Checkpoints:FindFirstChild(Checkpoint.Value)
char.HumanoidRootPart.CFrame = checkpoint.CFrame
end)
end)