` ``function onTouch(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
if game.Players:FindFirstChild(hit.Parent.Name) ~= nil then
local player = game.Players:FindFirstChild(hit.Parent.Name)
if player:FindFirstChild("PlayerGui"):FindFirstChild("ScreenGui") == nil then
sg = Instance.new("ScreenGui")
sg.Parent = player:FindFirstChild("PlayerGui")
end
if player.PlayerGui.ScreenGui:FindFirstChild("MessageBox") == nil then
local f = Instance.new("Frame")
f.Name = "MessageBox"
f.Position = UDim2.new(0.3, 0, 0.8, 0)
f.Size = UDim2.new(0.4, 0, 0, 50) -- If Text box needs to be bigger, simply change "0.4"
f.Style = "RobloxRound" -- Styles: "ChatBlue", "Chat Red", "Chat Green"
f.Parent = player.PlayerGui:FindFirstChild("ScreenGui")
local m = Instance.new("TextLabel")
m.Position = UDim2.new(0.5, 0, 0.5, 0)
m.FontSize = "Size14" -- Font Sizes: 10, 11, 12, 14, 18, 24
m.TextColor3 = Color3.new(1,1,1) -- Colors: (1,0,0) = Red, (0,1,0) = Green, (0,0,1) = Blue
m.Parent = f
m.Text = "I'm not a part of the staff but, " wait(2.5)
m.Text = "It's okay i guess..." wait(3)
f:Destroy()
end
end
end
end
script.Parent.Touched:connect(onTouch)```
I have this script and i want this to be destroyed after appearing but its replaying when i touch it again how can i make this

7 comments
This is ironically bad right?
I hope this is just a joke...
I think its called debounce or something? why do you think its a joke?
Lines 6 and 7 are the cause of the problem. After the script has fired and the ScreenGui has been destroyed, you're able to touch it again and it will create a new ScreenGui for you, as displayed on lines 6 and 7. It's best to remove those lines, or not, depending on if this post is most likely a joke or not. Seems like a joke to me.
Watch https://www.youtube.com/watch?v=HoZkuvd6RPA
add script.Disabled = true this will disable the script. Put it on the first line
I'm confused.