use Part.TouchEnded:Connect(function(hit)
more information here: https://developer.roblox.com/en-us/api-reference/event/BasePart/TouchEnded
(
local part = script.Parent
local debounce = false
part.Touched:Connect(
function(hit)
if debounce == false then
debounce = true
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then
plr:WaitForChild("PlayerGui").Quest1.Frame.Visible = true
("PlayerGui").Quest1.Frame.Visible = true
end
wait(3)
debounce = false
else
print("wait.........")
end
end
)
part.TouchEnded:Connect(
function()
if debounce == false then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
plr:WaitForChild("PlayerGui").Quest1.Frame.Visible = false
end
end
)
note: fla is nil and I remove while wait(1) do because it will either break the code or be glitchy