Hello I try to move my "WatseBinGui" from Repiclatedstorage to the PlayerGUI but nothing happens on click.
-- 17:46:55.248 - Workspace.WasteBin.Script:5: attempt to index nil with 'PlayerGui' --
Heres my script:
local p = game.Players.LocalPlayer local ClickDetector = script.Parent.ClickDetector function onClick(click) local PlayerGui = p.PlayerGui local WasteBinGui = game.ReplicatedStorage.GUI.WasteBin.WasteBinGUI local Clone = WasteBinGui:Clone() Clone.Parent = PlayerGui end ClickDetector.MouseClick:connect(onClick)
I'm not sure, but i don't think that ReplicatedStorage can render GUIs. I'd instead let a Disabled GUI in PlayerGUI and make enabled clones of it when the function is called.
The script of yours should be successfully indexing the PlayerGUI, but probrably isn't because it's a ServerScript. Transcript the code onto a LocalScript and it should work.