I have a part surrounding the chest and then a script inside of it. But Nothing happens. I want the GUI to appear and then if you walk to it again it gets closed.
local storage = game:GetService("ServerStorage")
local gui = storage.CarUI
local part = workspace.ChestTrigger
local deb = false
local path = game.Players.LocalPlayer.PlayerGui.CarUI
part.Touched:connect(function()
if (deb == false) then
gui:Clone().Parent = game.Players.LocalPlayer.PlayerGui
wait(2)
deb = true
elseif (deb == true) then
path:Destroy()
deb = false
end
end)
PLEASE help me.

3 comments
Thanks :)
Can't I do a touch ended function?
You can but due to physics Touched and TouchEnded events would fire a bunch. If you really don't want an 'x' button on your UI, PM me on discord i'll walk you through what you can do alternatively.