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

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

Asked by 7 years ago
Edited by shayner32 7 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

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
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. M39a9am3R 3210 — 7y
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) DivineObliteration 9 — 7y
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. M39a9am3R 3210 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago
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)
0
Thanks but the same problem still occurs, "playerscript is not a valid member of player" DivineObliteration 9 — 7y
0
script.Parent needs to be Script.Parent. shayner32 478 — 7y
0
I tried but no, the problem is really the fact that the script can't find PlayerScripts inside Player for some reason. DivineObliteration 9 — 7y
0
Is it 'StarterPlayerScripts'? So maybe (player.StarterPlayerScripts)? FiredDusk 1466 — 7y
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 elitekiller2342 87 — 5y
Ad

Answer this question