What I'm trying to do is when the player touches a part, it checks if the player has the GUI, and if they don't, it clones the GUI into the player. The GUI is supposed to destroy itself 3 seconds after showing the GUI, meaning that you are able to touch the part again. However, this only works once, and touching the part again does nothing. How do I fix this?
function onTouched(hit)
if hit.Parent:findFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player.PlayerGui:FindFirstChild("lock") then
print("lock exists")
else
script.lock:Clone().Parent = player.PlayerGui
end
end
end
script.Parent.Touched:connect(onTouched)

1 comment
Thank you! I understand now.