Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I am trying to re-enable a disabled LocalScript in the PlayerGui but it's not working, help?

As in the title says there is a disabled LocalScript in the StarterGui

While playing the game the disabled LocalScript is at the Player's PlayerGui

To make it work I wrote this script (script's Parent is Workspace):

local wow = game.Players.LocalPlayer
wow.PlayerGui.LocalScript.Disabled = false

and I get this error at the developer console: Workspace.Script:2: attempt to index nil with 'PlayerGui'

Could anyone help or tell me what am I doing wrong?

1 answer

LocalPlayer can only be accessed from the client.

You could use the player parameter of the PlayerAdded event to get the player on the server.

EX:

game.Players.PlayerAdded:Connect(function(player)
	player:WaitForChild("PlayerGui"):WaitForChild("LocalScript").Disabled = false
end)

There are numerous other ways of accessing the player from the server. Please be more specific with what you're trying to accomplish.

Have a good Easter Monday! :-)

1 comment

0

thank you so much!

This discussion is preserved as it was. New answers, comments, and votes are closed.