So I am making a gui tablet but I beleive there is a problem with this script,the gui won't show up when I equip it,it worked in solo mode but not public.
local gui = script.Parent.TabletGui:Clone() function Equip() gui.Parent = game.Players.LocalPlayer.PlayerGui end function Unequip() gui.Parent = nil end script.Parent.Equipped:connect(Equip) script.Parent.Unequipped:connect(Unequip)
local gui = script.Parent.TabletGui:Clone() local plr = game.Players.LocalPlayer function Equip() gui.Parent = plr:WaitForChild("PlayerGui") end function Unequip() if plr:WaitForChild("PlayerGui"):FindFirstChild("TabletGui") then plr.PlayerGui:FindFirstChild("TabletGui"):Destroy() end end script.Parent.Equipped:connect(Equip) script.Parent.Unequipped:connect(Unequip)
Make sure this is a local script or this will not work.
Here is a simple fix for your script:
function Equip() local Player = game.Players.LocalPlayer local gui = script.Parent['TabletGui'] if not UI and gui and Player and Player:FindFirstChild('PlayerGui') then UI = gui:Clone() UI.Parent = Player.PlayerGui end end function Unequip() if UI then UI:remove() UI = nil end end script.Parent.Equipped:connect(Equip) script.Parent.Unequipped:connect(Unequip)