Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Not a valid member of PlayerGui?

Asked by
Nep_Ryker 131
6 years ago
Edited 6 years ago

This is the script

local followMouse = script.Parent.Parent.FollowMouseScript

followMouse.Disabled = false

I checked a bunch of times, it is a member of PlayerGui!!! But it just keeps giving me this error saying FollowMouseScript is not a valid member of PlayerGui, is this a bug or is it really just me!?

The script above is a Script inside a Gui inside StarterGui, and I made it to activate a LocalScript that is inside StarterGui.

I tested this 10 times or more, and it keeps bringing me the same error!

2 answers

Log in to vote
0
Answered by 6 years ago

Try using :

local followMouse = script.Parent.Parent:WaitForChild('FollowMouseScript')

followMouse.Disabled = false

The only difference is that you're waiting for it to exist. Because the script might be trying to define it when the followmousescript hasn't been loaded yet.

0
exactly. had similar problem when making a train driving script and it required certain values, and it was randomly throwing an error. NsNidPL 41 — 6y
0
Oh mehhh guud, Thank u so much it's a masterpiece now becuz of u!! :D Nep_Ryker 131 — 6y
0
no problem :) brokenVectors 525 — 6y
Ad
Log in to vote
0
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
6 years ago

If your game is FE, scripts cannot access the descendants of PlayerGui. Try doing something other than that

0
Thing is, it's not FE. :p Nep_Ryker 131 — 6y
0
well, then you're probably not waiting for the gui instances to load, because everything doesn't load in immediately as you join the game. Use WaitForChild() Rare_tendo 3000 — 6y
0
they CAN access but if a player script modifies something in PlayerGui then the server and other players wont see changes to it and may break some scripts. NsNidPL 41 — 6y
0
A server - sided script(Normal script) can access the PlayerGui instance, but not its descendants when FE is enabled. He's not dealing with FE Rare_tendo 3000 — 6y
0
Well, thanks for the extra information and for the answer too. Nep_Ryker 131 — 6y

Answer this question