Firstly, I already made my obby checkpoint which works well but the one thing that bothers me is when you reset your character the UI checkpoint reappears even after claiming it. Here’s an example of when I claim the checkpoint :
Here’s an example of when I reset after claiming the checkpoint :
I don’t want this to reappear when I reset as I’ve already claimed the checkpoint.
For my checkpoints, I have 2 scripts. A local script which is located in the StarterGui and a script which is located in the ServerScriptService. The local script creates the effect, like the UI, particles, and the neon light effect. The script keeps account of what stage you are in and teleports you to that stage when you die.
Script:
local Checkpoints = workspace.Checkpoints
local stages = 1
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(chr)
wait()
chr.HumanoidRootPart.CFrame = Checkpoints[stages].CFrame
for i, stage in pairs(Checkpoints:GetChildren()) do
stage.Touched:Connect(function(Hit)
if Hit.parent == chr then
if tonumber(stage.Name) > stages then
stages = tonumber(stage.Name)
end
end
end)
end
end)
end)
Local Script:
local player = game.Players.LocalPlayer
local character = player.Character
local checkSound = game.ReplicatedStorage.Checkpoint_Shadow
local effect = game.ReplicatedStorage.ParticleEmitter:Clone()
local plyrGui = game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui')
local UI = plyrGui:WaitForChild("CheckpointDisplay")
local debounce = true
local Checkpoints = workspace.Checkpoints
local stages = 1
for i, stage in pairs(Checkpoints:GetChildren()) do
stage.Touched:Connect(function(Hit)
if Hit.parent == character then
if tonumber(stage.Name) > stages then
stages = tonumber(stage.Name)
print(stages)
stage.Material = Enum.Material.Neon
effect.Parent = stage
checkSound:Play()
UI.Enabled = true
checkSound.Ended:Wait()
UI.Enabled = false
stage.Material = Enum.Material.SmoothPlastic
effect:Remove()
end
end
end)
end
I’ve realized that my local script resets the stages every time I reset my character, I’ve tried ways to work around it like creating an IntValue that stores your stages in a ReplicatedStorage or a remote event that would add your stages but they all lead to the same results.
Can someone help me find an answer, I would much appreciate it
SOLUTION :
The solution was to have bool values inserted in each checkpoint, and when you step on the checkpoints the bool value changes.