gui = script.Parent.Text:Clone()
enabled = true
function onTouch(hit)
player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player ~= nil and enabled == true then
enabled = false
for k, v in pairs(player.PlayerGui:GetChildren()) do
if v.Name == "Text" then
v.Parent = nil
end
wait()
end
wait(0.5)
gui.Parent = player.PlayerGui
wait(3)
enabled = true
end
end
script.Parent.Touched:connect(onTouch)
This script wipes out existing guis in the PlayerGui named "Text" and replaces it with another gui. However, complications arise when a player continues to touch the object. It will register the touch again, wiping out the existing gui and put it back, creating an unappealing "blinking" effect (gui being deleted and replaced over and over). To avoid this, I want the script to wipe out the guis in PlayerGui ONCE but keep the cloned gui in PlayerGui until the player is no longer touching the object. Is this possible? If so, how?

2 comments
Thanks! I just have one question, where in the script should I place the lines that check if the GUI is in existance?
You could just add it into the if statement on line 06 with another and. Just make sure it comes after you check if the player exists. It can be in the same if statement, but don't plop it at the beginning.