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 » Scripting Helpers
Home Search
 

Simple player added script not working?

Previous Thread :: Next Thread 
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
15 Dec 2013 05:05 PM
I haven't scripted in a while, and I might just not be noticing something utterly stupid but my script I just made that supposed to clone another script into a player when they enter the game doesn't seem to be working, the output says nothing :/
Here's the script:

script = game.Lighting.TitleScript
function added(plyr)
news = script:clone()
news.Parent = plyr
end

game.Players.PlayerAdded:connect(added)
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
15 Dec 2013 05:07 PM
Two possible solutions:
1. Try using ReplicatedStorage instead of Lighting
2. Put the Script inside of the Player's PlayerGui or Backpack

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
15 Dec 2013 05:09 PM
I'm not sure what happens when you set
script
as a variable...
Try changing the variable name to newScript or something...
and also Disable the script you're copying then undisable it after you parent it?

Or the script is... well... "dead".
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
15 Dec 2013 05:10 PM
Neither of those worked :/
And by the way, what is ReplicatedStorage? I was inactive for about a year and I guess I missed when they put that in.
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
15 Dec 2013 05:12 PM
@wazap,
I changed the variable name and nothing happened,
and the problem I'm having is that it's not even cloning it there, not that it's not running.
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
15 Dec 2013 05:13 PM
Huh... is your script inactive when you clone it?

ServerScriptStorage: You should put all Script objects in here that don't reply on specific parts. They cannot be modified/stolen because they only exist to the server. Scripts put in here will run.
ServerStorage: You can put objects here that you will only be using with the server (normal Scripts). Scripts put in here will not run.
ReplicatedStorage: Basically, Lighting. Scripts in here will not run, and the objects in here will be available to everyone.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
15 Dec 2013 05:15 PM
@ DaMrNelson
No, I just added a part to make sure it's active before it clones it and still nothing, could it be that I'm testing it in Play Solo? I've had some problems with that in the past.
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
15 Dec 2013 05:20 PM
Ah yes, that could be it. Try it in Tools -> Test -> Start Server, then Tools -> Test -> Start Player

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
15 Dec 2013 05:24 PM
Ok I tried that and something appeared in the output, saying "PlayerGui is not a valid member of Player"
Ya... This is confusing me now, since I know PlayerGui is a member of Player :/
Perhaps the playeradded connection is setting plyr to the Character of the new Player?
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
15 Dec 2013 05:26 PM
Try using Player:WaitForChild("PlayerGui") before using any references to it.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
15 Dec 2013 05:28 PM
Aha! It finally worked, thanks!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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