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

why my script (with Touched event) of pop-up only works one time ?

Asked by 5 years ago

Hello everyone, I'd like to know why my script works but one time:

function touch(hit)
    if game.Players:findFirstChild(hit.Parent.Name) ~= nil then
       local player = game.Players[hit.Parent.Name]
        if player.PlayerGui:findFirstChild("Info") == nil then
            local gui = script.Parent.Info:Clone()
            gui.Parent = player.PlayerGui
            player.PlayerGui.Info.Title.BackgroundTransparency = 0.95
            player.PlayerGui.Info.Title.TextTransparency = 0.8
            wait(0.1)
            player.PlayerGui.Info.Title.BackgroundTransparency = 0.75
            player.PlayerGui.Info.Title.TextTransparency = 0.6
            wait(0.1)
            player.PlayerGui.Info.Title.BackgroundTransparency = 0.65
            player.PlayerGui.Info.Title.TextTransparency = 0.4
            wait(0.1)
            player.PlayerGui.Info.Title.BackgroundTransparency = 0.55
            player.PlayerGui.Info.Title.TextTransparency = 0.2
            wait(0.1)
            player.PlayerGui.Info.Title.BackgroundTransparency = 0.5
            player.PlayerGui.Info.Title.TextTransparency = 0
            player.PlayerGui.Info.Title.Visible = true
            wait(5)
            repeat
                wait()
            until (player.Character.LowerTorso.Position - script.Parent.Position).magnitude > 5
            player.PlayerGui.Info.Title.BackgroundTransparency = 0.65
            player.PlayerGui.Info.Title.TextTransparency = 0.2
            wait(0.1)
            player.PlayerGui.Info.Title.BackgroundTransparency = 0.75
            player.PlayerGui.Info.Title.TextTransparency = 0.4
            wait(0.1)
            player.PlayerGui.Info.Title.BackgroundTransparency = 0.85
            player.PlayerGui.Info.Title.TextTransparency = 0.6
            wait(0.1)
            player.PlayerGui.Info.Title.BackgroundTransparency = 0.95
            player.PlayerGui.Info.Title.TextTransparency = 0.8
            wait(0.1)
            player.PlayerGui.Info.Title.BackgroundTransparency = 1
            player.PlayerGui.Info.Title.TextTransparency = 1
            player.PlayerGui.Info.Title.Visible = false
        end
    end
end
script.Parent.Touched:connect(touch)

Thank you in advance !

0
You need to clarify your issue more. Nickuhhhhhhhhhhhhhhh 834 — 5y
0
Okay @Nickuhhhhhhhhhh, so to be more precise my script when I touched my part, it displays a textlabel with the place where it was hit. It works but when I go back on my part and it doesn't do anything anymore. Altair77100 6 — 5y

Answer this question