I want my script to wait before you can "Talk" to the NPC again. The script i am going to be showing you is making the GUI visible. I need it so it dosent go instantly when you stay on again when the script finishes. off
local debounce = false
function getPlayer(humanoid)
local players = game.Players:children()
for i = 1, #players do
if players[i].Character.Humanoid == humanoid then return players[i] end
end
return nil
end
function onTouch(part)
local human = part.Parent:findFirstChild("Humanoid")
if (human ~= nil) and debounce == false then
debounce = true
local player = getPlayer(human)
if (player == nil) then return end
script.Parent:clone().Parent = player.PlayerGui
wait(8)
debounce = false
player.PlayerGui.Chatbox1:remove()
wait(3)
debounce = false
wait(5)
end
end
script.Parent.Parent.Touched:connect(onTouch)
Thank you!

1 comment
Try using "Connect" instead of "connect", "Destroy()" instead of "remove()", and "Clone" instead of "clone".