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
 

Re: PlayerAdded Help.

Previous Thread :: Next Thread 
XhymbbQd6 is not online. XhymbbQd6
Joined: 22 Jul 2011
Total Posts: 1468
03 Jul 2012 02:20 AM
Alright, final thing i would like to get help in.
Keep this in mind, i never used this function.


Bool1 = Instance.new("BoolValue")

function Added(PlayerAdded)
Bool1.Name = "NameHere"
Bool1:Copy()
Bool1.Parent = game.Players.PlayerAdded.Player
end

script.Parent.PlayerAdded:connect(Added)

Okay, it inserts a BoolValue into every new player. I will be adding a lot more bools (in the future) but would like help with this 'template'
I have never learned nor used PlayerAdded...so sorry if this is horrible.
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
03 Jul 2012 02:22 AM
Bool1 = Instance.new("BoolValue")

function Added(Player)
Bool1.Name = "NameHere"
bc = Bool1:Copy()
bc.Parent = game.Players.Player
end

script.Parent.PlayerAdded:connect(Added)
Report Abuse
dddylan98 is not online. dddylan98
Joined: 16 Jul 2008
Total Posts: 1497
03 Jul 2012 02:22 AM
Bool1 = Instance.new("BoolValue")

function Added(PlayerAdded)
Bool1.Name = "NameHere"
Bool2 = Bool1:Clone()
Bool2.Parent = PlayerAdded
end

script.Parent.PlayerAdded:connect(Added)
Report Abuse
XhymbbQd6 is not online. XhymbbQd6
Joined: 22 Jul 2011
Total Posts: 1468
03 Jul 2012 02:23 AM
So when i wanna add more i could simply do

Bool1 = Instance.new("BoolValue")
Bool2 = Instance.new("BoolValue")


function Added(Player)
Bool1.Name = "NameHere"
bc = Bool1:Copy()
bc.Parent = game.Players.Player

Bool2.Name = "NameHere"
bc1 = Bool2:Copy()
bc1.Parent = game.Players.Player
end

script.Parent.PlayerAdded:connect(Added)

Right?
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
03 Jul 2012 02:23 AM
u sluw?
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
03 Jul 2012 02:24 AM
Yup or you could look up the "for" loop in wiki and start experimenting with it.
Report Abuse
XhymbbQd6 is not online. XhymbbQd6
Joined: 22 Jul 2011
Total Posts: 1468
03 Jul 2012 02:24 AM
Mostly i copy/paste and change it to the following Bools? And changing bool2 to a higher number leading it to the Variable.
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
03 Jul 2012 02:25 AM
Oh sry. Quite inefficient. This is better:

Bool1 = Instance.new("BoolValue")
Bool2 = Instance.new("BoolValue")


function Added(Player)
Bool1.Name = "NameHere"
Bool1.Parent = game.Players.Player

Bool2.Name = "NameHere"
Bool2.Parent = game.Players.Player
end

script.Parent.PlayerAdded:connect(Added)
Report Abuse
dddylan98 is not online. dddylan98
Joined: 16 Jul 2008
Total Posts: 1497
03 Jul 2012 02:25 AM
Never heard of :Copy() only :Clone()

game.Players.Player

can just be

Player

and not

game.Players.Player because Player is a variable and yeah...
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
03 Jul 2012 02:27 AM
Ya I made mistakes aswell. xD

I always take a fast look at it and start writing but I never take a close look at it. lol
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
03 Jul 2012 02:28 AM
There you go:

Bool1 = Instance.new("BoolValue")
Bool2 = Instance.new("BoolValue")


function Added(Player)
Bool1.Name = "NameHere"
Bool1.Parent = Player

Bool2.Name = "NameHere"
Bool2.Parent = Player
end

game.Players.PlayerAdded:connect(Added)
Report Abuse
dddylan98 is not online. dddylan98
Joined: 16 Jul 2008
Total Posts: 1497
03 Jul 2012 02:28 AM
I usually do that but this is why I was slow.
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
03 Jul 2012 02:29 AM
+1 for you and -1 for me. :/
Report Abuse
XhymbbQd6 is not online. XhymbbQd6
Joined: 22 Jul 2011
Total Posts: 1468
03 Jul 2012 01:21 PM
Alright thank you (sorry I'm replying now, went to bed) I'll be needing to insert a lot of Values into players for a new game.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
03 Jul 2012 01:44 PM
The problem with all of yours is the fact that only once that script will work. It will break for multiple people because the bool value is gone becuase it is parented already. Here, a simple fix.



function Added(Player)
Bool1 = Instance.new("BoolValue")
Bool2 = Instance.new("BoolValue")

Bool1.Name = "NameHere"
Bool1.Parent = Player

Bool2.Name = "NameHere"
Bool2.Parent = Player
end

game.Players.PlayerAdded:connect(Added)





~thedestroyer115, the most helpful builder!~
Report Abuse
XhymbbQd6 is not online. XhymbbQd6
Joined: 22 Jul 2011
Total Posts: 1468
03 Jul 2012 01:54 PM
Isn't that the same as Cheaters thedestroyer115
Report Abuse
Nartle is not online. Nartle
Joined: 29 Mar 2008
Total Posts: 7202
03 Jul 2012 01:56 PM
It's not the same.

Now the BoolValues will be made every time a new player joins, when before it only happened once because there was only one set of them (No clones or nothing to make new ones)
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
03 Jul 2012 02:09 PM
Thank you for explaining that, Nartle.
Report Abuse
XhymbbQd6 is not online. XhymbbQd6
Joined: 22 Jul 2011
Total Posts: 1468
03 Jul 2012 02:11 PM
Aaah okay. That makes sense.

Do you mind helping me with my other post? I don't post in SH often but i'm using things that are brand new to me.. Like Bools and for loops.
Report Abuse
Nartle is not online. Nartle
Joined: 29 Mar 2008
Total Posts: 7202
03 Jul 2012 02:13 PM
No problem. I like explaining things that I can actually make sense of.

If only I would get this kind of help in my threads >_> Xhy, I'm on my way :O
Report Abuse
Nartle is not online. Nartle
Joined: 29 Mar 2008
Total Posts: 7202
03 Jul 2012 02:17 PM
That post confused me.
Report Abuse
XhymbbQd6 is not online. XhymbbQd6
Joined: 22 Jul 2011
Total Posts: 1468
03 Jul 2012 02:21 PM
This one.

http://www.roblox.com/Forum/ShowPost.aspx?PostID=71409468
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