So my GUI is working perfectly fine in studio, but not in game. the Server log Error in game reads:
Workspace.Part.Script:5: attempt to index field "LocalPlayer" (a nil value)
Here is my script
local Gui = script.Parent.CardGiverGui function onClicked() local GUI = Gui:Clone() GUI.Parent = game.Players.LocalPlayer.PlayerGui end script.Parent.ClickDetector.MouseClick:connect(onClicked)
The problem is that only a local script has access to the property LocalPlayer.
The MouseClick event passes the player who clicked it as an arg.
Example(Server Script):-
local Gui = script.Parent.CardGiverGui function onClicked(plrWhoClicked) -- you might also want to check if they have the gui Gui:Clone().Parent = plrWhoClicked.PlayerGui end script.Parent.ClickDetector.MouseClick:connect(onClicked)
I hope this help.