`I have it setup so when a player goes through an invisible part a surface gui pops up on the door with text. Unfortunately when the player goes through the block it keeps replaying the fade in animation. Is there any way to prevent it from repeating untill the player leaves the trigger block?
local trigger = game.Workspace.Trigger
local door = game.Workspace.Door
triggered = false
trigger.Touched:connect(function(hit)
if triggered == false and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
door.SurfaceGui.TextButton.BackgroundTransparency = 1
door.SurfaceGui.TextButton.TextTransparency = 1
wait(.1)
door.SurfaceGui.TextButton.BackgroundTransparency = 0.9
door.SurfaceGui.TextButton.TextTransparency = 0.9
wait(.1)
door.SurfaceGui.TextButton.BackgroundTransparency = 0.8
door.SurfaceGui.TextButton.TextTransparency = 0.8
wait(.1)
door.SurfaceGui.TextButton.BackgroundTransparency = 0.7
door.SurfaceGui.TextButton.TextTransparency = 0.7
wait(.1)
door.SurfaceGui.TextButton.BackgroundTransparency = 0.6
door.SurfaceGui.TextButton.TextTransparency = 0.6
wait(.1)
door.SurfaceGui.TextButton.BackgroundTransparency = 0.5
door.SurfaceGui.TextButton.TextTransparency = 0.5
wait(.1)
door.SurfaceGui.TextButton.BackgroundTransparency = 0.4
door.SurfaceGui.TextButton.TextTransparency = 0.4
wait(.1)
door.SurfaceGui.TextButton.BackgroundTransparency = 0.3
door.SurfaceGui.TextButton.TextTransparency = 0.3
wait(.1)
door.SurfaceGui.TextButton.BackgroundTransparency = 0.2
door.SurfaceGui.TextButton.TextTransparency = 0.2
wait(.1)
door.SurfaceGui.TextButton.BackgroundTransparency = 0.1
door.SurfaceGui.TextButton.TextTransparency = 0.1
wait(.1)
door.SurfaceGui.TextButton.BackgroundTransparency = 0
door.SurfaceGui.TextButton.TextTransparency = 0
triggered = true
end
end

4 comments
Put triggered = true below the then statement
Worked Thanks
Np.
If you've fixed your problem, please put something like "[Solved]" in the title