I made this script for my Airport check in. When the Airport staff sits down, they can control the conveyor via a GUI. But when you jump up it's still there. I can't find the code through the wiki. Any suggestions?
gui = game.Lighting.CheckIn function getGUI(u) print("hit") h = u.Parent:FindFirstChild("Humanoid") if h ~= nil then print("human") user = game.Players:GetPlayerFromCharacter(u.Parent) gtest = user.PlayerGui:FindFirstChild("CheckIn") if gtest == nil then local g = gui:Clone() g.Parent = user.PlayerGui print("Cloned") end end end script.Parent.Touched:connect(getGUI)
I think using a TouchEnded event might work:
gui = game.Lighting.CheckIn function getGUI(u) print("hit") h = u.Parent:FindFirstChild("Humanoid") if h ~= nil then print("human") local user = game.Players:GetPlayerFromCharacter(u.Parent) local gtest = user.PlayerGui:FindFirstChild("CheckIn") if gtest == nil then g = gui:Clone() g.Parent = user.PlayerGui print("Cloned") end end end function removeGUI() if g then g:Destroy() end end script.Parent.Touched:connect(getGUI) script.Parent.TouchEnded:connect(removeGUI)