Server script:
function onMouseClick() local player = game.Players.LocalPlayer player.PlayerGui.celMenu.Enabled = true end script.Parent.MouseClick:Connect(onMouseClick)
Error:
Workspace.Part.ClickDetector.Script:3: attempt to index nil with 'PlayerGui'
I want this GUI to be enabled when a player clicks a part but I get the error above whenever I click the part.
There is no LocalPlayer in a ServerScript. Instead you can get the player from the player parameter.
function onMouseClick(player) player.PlayerGui.celMenu.Enabled = true end script.Parent.MouseClick:Connect(onMouseClick)