Hello, I have here a script that pops up a Gui from the model it is in, I was wondering how or what I would add to have the script delete a previous Gui that was still active before it so, that this would destroy the previous rather than both being active.
Popup = script.Parent.Message
Ready = true
function onTouch(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if h ~= nil and Ready == true then
Ready = false
local plyr = game.Players:FindFirstChild(h.Parent.Name)
local c = Popup:clone()
c.Parent = plyr.PlayerGui
wait(8)
c:remove()
wait(50)
Ready = true
end
end
script.Parent.Touched:connect(onTouch)
