I am making a GUI shows up where the player misses the checkpoint instead of going to the checkpoint that they suppose to go but the GUI isn’t showing.
Image:
script:
local Stage = workspace:WaitForChild("Stages")
local debounce = false
for i,Stage in pairs(Stage:GetChildren()) do
Stage.Touched:Connect(function(touch)
local humanoid
if touch.Parent:FindFirstChild("Humanoid") then
humanoid = touch.Parent:FindFirstChild("Humanoid")
end
if touch.Parent and touch.Parent.Parent:FindFirstChild("Humanoid") then
humanoid = touch.Parent.Parent:FindFirstChild("Humanoid")
end
if humanoid then
local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)
local PlayerStage = player.leaderstats.Stage.Value
if tonumber(Stage.Name) > PlayerStage + 1 then
if not debounce then
debounce = true
script.Parent.Parent.Invalid:Play()
script.Parent.Visible = true
wait(5)
script.Parent.Visible = false
wait(0.1)
debounce = false
end
end
end
end)
end
btw theres no error and warnings in the output of the missed checkpoint