Problem is that the following script (regular script in workspace) only runs the following function once, then even though I remove the gui from playergui it does not work I will post the script that removes the gui at the end
Script
local debounce = false -- I have edited the script to leave out other things. function getPlayer(humanoid) local players = game.Players:children() for i = 1, #players do if players[i].Character.Humanoid == humanoid then return players[i] end end return nil end function onTouch(part) local human = part.Parent:findFirstChild("Humanoid") local player = getPlayer(human) if player:WaitForChild('PlayerGui'):FindFirstChild('Gui')== nil then local PlayerGui = player:WaitForChild('PlayerGui') if (player == nil) then return end local Gui = script:WaitForChild('Gui') Gui:Clone().Parent = PlayerGui end end script.Parent.Touched:connect(onTouch)
Other Script
script.Parent.MouseButton1Down:connect(function() script.Parent.Parent:Destroy() end)