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: hey y'all, can I get some help with this?

Previous Thread :: Next Thread 
sycips is not online. sycips
Joined: 21 Mar 2011
Total Posts: 1368
24 Oct 2011 09:40 AM
I've got a problem... If you play my game, you finally get some tools. But everyone gets the same tool like: there's a tool in the lighting folder and everyone has to get a copy. My script lines are:

for i,v in pairs(game.Players:GetChildren()) do
game.Lighting.Tool:clone().Parent = v.Backpack
end

this script works in solo play, but if I do it online no one will get the tool... Does someone know how to give everyone a copy of one tool at the same time and it also does work online in a server?

plz awnser!!!

~sycips~
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
24 Oct 2011 09:51 AM
[ Content Deleted ]
Report Abuse
07lchris is not online. 07lchris
Joined: 28 Feb 2010
Total Posts: 1603
24 Oct 2011 10:12 AM
for i,v in pairs(game.Players:GetChildren()) do
local T = game.Lighting.Tool:Clone()
T.Parent = v.Backpack
M_P = Instance.new('Message', game.Workspace)
M_P.Text = 'Tool given to '..v.Name
end

It depends on where the script is and how you are activating it. Try this and tell me what happens 'online'.
Report Abuse
sycips is not online. sycips
Joined: 21 Mar 2011
Total Posts: 1368
24 Oct 2011 10:46 AM
It does work 0_0 but why? I did the same thing, you only put a message in it...
Report Abuse
UttermostExedra is not online. UttermostExedra
Joined: 28 Dec 2009
Total Posts: 2483
24 Oct 2011 10:49 AM
local tools = { -- put your tools here.
game.Lighting.Tool,
game.Lighting.Tool2,
game.Lighting.Tool3
}

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function()
for i,v in pairs(tools) do
v:clone().Parent = plr.Backpack
end
end)
end)
Report Abuse
sycips is not online. sycips
Joined: 21 Mar 2011
Total Posts: 1368
24 Oct 2011 11:14 AM
nvm Ik what the real problem was:

I used this:

pls = game.Players:GetChildren()

for i,v in pairs(pls) do
end

it should be:

for i,v in pairs(game.Players:GetChildren()) do
end

you may not use the shortcut pls...
I did that because I used game.Players:GetChildren() many times, like 6 times...
Report Abuse
07lchris is not online. 07lchris
Joined: 28 Feb 2010
Total Posts: 1603
24 Oct 2011 01:55 PM
You could always do:

pls = game.Players

for i,v in pairs(pls:GetChildren()) do
end
Report Abuse
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
24 Oct 2011 02:18 PM
pls = game.Players:GetChildren()
for i,v in pairs(pls) do ... end

for i,v in pairs(game.Players:GetChildren()) do ... end

pls = game.Players
for i,v in pairs(pls:GetChildren()) do ... end

All three of those methods will work (the top one gets the table once though, probably as the server starts and there are no players. I don't suggest it)

Anywho, I don't suggest using game.Players:GetChildren() if you want all the players. Using the method :GetPlayers() is a much safer way to get all the players and make sure the script doesn't beak.

Regards,
~Scarfacial
Report Abuse
sycips is not online. sycips
Joined: 21 Mar 2011
Total Posts: 1368
27 Oct 2011 11:35 AM
y using getplayers()? the only Object in that folder is a player... Have you ever seen a script in that folder?-_-
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