Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Prevent Door Trigger from repeating fade in gui? (solved)

Asked by
bopqwe 4
6 years ago
Edited 6 years ago

`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
0
Put triggered = true below the then statement oSyM8V3N 429 — 6y
0
Worked Thanks bopqwe 4 — 6y
0
Np. oSyM8V3N 429 — 6y
0
If you've fixed your problem, please put something like "[Solved]" in the title chess123mate 5873 — 6y

Answer this question