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

"Playerscript is not a valid member of player" How to fix?

I made a script that does everything it is supposed to, it even works fine in play mode, but in test or online mode it doesn't work. The output says "PlayerScript is not a valid member of player", but I can't figure out what is wrong. Can someone please help? Here is the part I am having trouble with

local Script = script.LocalScript:clone()
script.Parent = player.PlayerScripts

3 comments

0

Is this a server script? Additionally, just because it works in Play Mode NEVER means it will work in online mode. Play mode takes the client and the server and puts them in one. Online mode is completely absolutely separate.

0

I know, I just said that to mention that everything I know of except that part has been done properly. (Or so I believe)

0

So this is a server script correct? I'm pretty sure the server has no access to the PlayerScripts once the player joins the game. You would need to clone the LocalScript to StarterPlayerScripts.

1 answer

local Script = script.LocalScript:Clone() --Capitalize that C in :Clone()
script.Parent = player.PlayerScripts --Make the 's' in script into 'S', it has to follow grammar rules (unless you are talking about the script this code is in)

5 comments

0

Thanks but the same problem still occurs, "playerscript is not a valid member of player"

0

script.Parent needs to be Script.Parent.

0

I tried but no, the problem is really the fact that the script can't find PlayerScripts inside Player for some reason.

0

Is it 'StarterPlayerScripts'? So maybe (player.StarterPlayerScripts)?

0

Just did an experiment/testing and found something even stranger. I checked the name just to be sure that it wasn't somehow running in the different directory and the part passed fine. But what I also did was player:GetChildren() I used for i=1, #x to get each items name and found that the only objects that it registered as existing were Backpack and PlayerGui? WTF why is this happening

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