i have this so far, but am not that experienced and need help, im making a city world, and i dont want the gui for everyone, just the coldstone workers, so i have a handto gui on the chairs and it works but i need help making it dissappear when the person gets out of the chair i have this so far:
local Gui = game.Lighting.HandtoGUI
function GiveGui(Player) if Player.PlayerGui:FindFirstChild(Gui.Name)~=nil then return end Gui:Clone().Parent=Player.PlayerGui end
script.Parent.Touched:connect(function(hit)
local Player=game.Players:GetPlayerFromCharacter(hit.Parent) if Player==nil then return end GiveGui(Player)
end)
will someone help me add more so when the person is not touching it, it dissapears
Use TouchEnded.
local Gui = game.Lighting.HandtoGUI function GiveGui(Player) if Player.PlayerGui:FindFirstChild(Gui.Name)~=nil then return end Gui:Clone().Parent=Player.PlayerGui end function RemoveGui(Player) local gui = Player.PlayerGui:FindFirstChild(Gui.Name) if gui then gui:Destroy() end end script.Parent.Touched:connect(function(hit) local Player=game.Players:GetPlayerFromCharacter(hit.Parent) if Player==nil then return end GiveGui(Player) end) script.Parent.TouchEnded:connect(function(hit) local Player=game.Players:GetPlayerFromCharacter(hit.Parent) if Player==nil then return end RemoveGui(Player) end