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 !

2 comments

0

You need to clarify your issue more.

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.