I’m currently making a checkpoint system for my game. So far, I’ve made it so when you touch the checkpoint, the checkpoint value changes. However, I want to make it so that once a player touches a checkpoint, they can’t use it again. This way no players can accidentally go back to a previous checkpoint.
I’ve tried creating a bool value that changes when the checkpoint is touched, making it so the checkpoint can only be used if the value is false. What I wanted to happen does indeed happen. However, I could only do this on the server. I’m not quite sure how I would do this locally. Any suggestions?
You could add the player’s name via string inside of the checkpoint, so if the character’s name is within the checkpoint location, he/she can not re-activate the checkpoint.
You could also make a table like this when the checkpoint is touched:
local tab = {}
workspace.Checkpointtwo.Touched:Connect(function(part)
local player = part.Parent:FindFirstChild("Humanoid")
if player and tab[player.Parent.Name] == nil then
tab[player.Parent.Name] = true;
end
end
… so that the player will never re-trigger the checkpoint as well.
You can add a Table that check if that Checkpoint is in the table or not, If not then it will add that checkpoint to the Table, if yes then just ignore it.
Assuming the checkpoints are ordered, check if the player’s current checkpoint comes before the one they touched. If it doesn’t then ignore the checkpoint.