generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: PlayerScripts is not a valid member of the player?

Previous Thread :: Next Thread 
UnrealScript is not online. UnrealScript
Joined: 05 Jul 2017
Total Posts: 39
08 Aug 2017 04:38 PM
I've done :WaitForChild("PlayerScripts") but it doesn't seem to work. I don't understand why it is giving me this error since PlayerScripts is a valid member of the player.
Report Abuse
TheWindRises is online. TheWindRises
Joined: 24 Feb 2012
Total Posts: 678
08 Aug 2017 04:42 PM
game.Players.PlayerAdded:connect(function(player)
local scripts = player:WaitForChild("PlayerScripts")
end)

not sure if you're going for something like this but it seems to work in studio
Report Abuse
UnrealScript is not online. UnrealScript
Joined: 05 Jul 2017
Total Posts: 39
08 Aug 2017 04:47 PM
Thanks for the suggestion, but yet again I get an Infinite yield possible on 'Players.Player2:WaitForChild("PlayerScripts")'
Report Abuse
TheWindRises is online. TheWindRises
Joined: 24 Feb 2012
Total Posts: 678
08 Aug 2017 04:49 PM
game.Players.PlayerAdded:connect(function(player)
local scripts

if not player.PlayerScripts then
scripts = player:WaitForChild("PlayerScripts")
else
scripts = player.PlayerScripts
end
end)
Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
08 Aug 2017 04:49 PM
playerscripts is only accessible with local scripts
Report Abuse
TheWindRises is online. TheWindRises
Joined: 24 Feb 2012
Total Posts: 678
08 Aug 2017 04:51 PM
whoa i'm stupid.
1)

didnt realize that @AggressiveCatch

2)

player:FindFirstChild("PlayerScripts"), not player.PlayerScripts.
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
08 Aug 2017 04:53 PM
^^ Also, windrises, you have to use FindFirstChild to check for the existence of children

If PlayerScripts is not a child of player, then your conditional:

"if not player.PlayerScripts then"

will error.
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
08 Aug 2017 04:55 PM
Got ninja'd, QQ
Report Abuse
UnrealScript is not online. UnrealScript
Joined: 05 Jul 2017
Total Posts: 39
08 Aug 2017 05:01 PM
Thanks, also nice name you got there @Casualist
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image