GUI won't show when player missed a checkpoint

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:
RobloxScreenShot20220714_203551152

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

1 Like

Try using:

if debounce ~= true then

and add a “print()” below and see if it prints

it didn’t work, and it also didn’t print

add a print in the top of:

		if tonumber(Stage.Name) > PlayerStage + 1 then

and another print below of this line. See if it prints

they both didn’t print in the top and below of that line

Lol then add a print below the touch function.

The print still didn’t work, also the missed checkpoint script is a local script

If the touch function dont work then you need to rework your script, I recommend you to use “Collection Service”.
Here a link about it:
https://developer.roblox.com/en-us/api-reference/class/CollectionService
Video about it:

1 Like

okay the gui shows now and it is working, thanks for helping

1 Like