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
 

Does anyone know why this works when theres only 1 player in the server?

Previous Thread :: Next Thread 
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
24 Dec 2011 03:44 PM
while true do
wait()
local people = game.Players:GetChildren()
for i = 1,#people do
if game.Workspace.GamePlay.BombPlanted.Value == false then
if people[i].Character.Torso.BrickColor == BrickColor.new(game.Workspace.GamePlay.GameMode.Team.Value) then
if (people[i].Character.Torso.Position - script.Parent.Main.Position).magnitude <= 8 then
if people[i].PlayerGui:FindFirstChild("BombPlantGui") == nil then
game.Lighting:FindFirstChild("BombPlantGui"):Clone().Parent = people[i].PlayerGui
end
end
end
end
end
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
24 Dec 2011 03:46 PM
Try using a generic for instead of numeric.
Report Abuse
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
24 Dec 2011 03:47 PM
I have no clue what that means LOL
Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
24 Dec 2011 03:47 PM
while true do
repeat wait() until game.NumPlayers <= 2 -- ummm... this what your looking for?
wait()
local people = game.Players:GetChildren()
for i = 1,#people do
if game.Workspace.GamePlay.BombPlanted.Value == false then
if people[i].Character.Torso.BrickColor == BrickColor.new(game.Workspace.GamePlay.GameMode.Team.Value) then
if (people[i].Character.Torso.Position - script.Parent.Main.Position).magnitude <= 8 then
if people[i].PlayerGui:FindFirstChild("BombPlantGui") == nil then
game.Lighting:FindFirstChild("BombPlantGui"):Clone().Parent = people[i].PlayerGui
end
end
end
end
end

~I've been to nil and back.
Report Abuse
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
24 Dec 2011 03:49 PM
Noo I mean the whole script stops when there is more then 1 player in the server
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
24 Dec 2011 03:50 PM
@MrGameNWatch

He wants it to work for all players, not just one.

@CreatorofThread

Numeric for

local people = game.Players:GetChildren())
for i = 1,#people do
--code
end

Generic

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

Report Abuse
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
24 Dec 2011 03:56 PM
@miz656
It doesnt even work with 1 player now
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
24 Dec 2011 03:56 PM
That's caused you used it wrong.
Report Abuse
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
24 Dec 2011 04:01 PM
while true do
wait()
for i,v in pairs(game.Players:GetChildren()) do
if game.Workspace.GamePlay.BombPlanted.Value == false then
if people[i].Character:FindFirstChild("Torso") ~= nil then
if people[i].Character.Torso.BrickColor == BrickColor.new(game.Workspace.GamePlay.GameMode.Team.Value) then
if (people[i].Character.Torso.Position - script.Parent.Main.Position).magnitude <= 8 then
if people[i].PlayerGui:FindFirstChild("BombPlantGui") == nil then
game.Lighting:FindFirstChild("BombPlantGui"):Clone().Parent = people[i].PlayerGui
end
end
end
end
if (people[i].Character.Torso.Position - script.Parent.Main.Position).magnitude >= 8 then
if people[i].PlayerGui:FindFirstChild("BombPlantGui") ~= nil then
people[i].PlayerGui:FindFirstChild("BombPlantGui"):Remove()
end
end
end
end
end
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
24 Dec 2011 04:02 PM
Since you removed the numeric for Change people[i] to v.
Report Abuse
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
24 Dec 2011 04:05 PM
while true do
wait()
local people = game.Players:GetChildren()
for i,v in pairs(game.Players:GetChildren()) do
if game.Workspace.GamePlay.BombPlanted.Value == false then
if people[i].Character:FindFirstChild("Torso") ~= nil then
if people[i].Character.Torso.BrickColor == BrickColor.new(game.Workspace.GamePlay.GameMode.Team.Value) then
if (people[i].Character.Torso.Position - script.Parent.Main.Position).magnitude <= 8 then
if people[i].PlayerGui:FindFirstChild("BombPlantGui") == nil then
game.Lighting:FindFirstChild("BombPlantGui"):Clone().Parent = people[i].PlayerGui
end
end
end
end
if (people[i].Character.Torso.Position - script.Parent.Main.Position).magnitude >= 8 then
if people[i].PlayerGui:FindFirstChild("BombPlantGui") ~= nil then
people[i].PlayerGui:FindFirstChild("BombPlantGui"):Remove()
end
end
end
end
end
end
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
24 Dec 2011 04:06 PM
Lol, bro! You can't have a numeric and generic loop.

Choose!
Report Abuse
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
24 Dec 2011 04:07 PM
... Just do it for me please
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
24 Dec 2011 04:10 PM
Can't do it now because my family is here and I have to log off soon.

Later if it's still not fixed.
Report Abuse
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
24 Dec 2011 04:12 PM
Ok, Thanks!
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
24 Dec 2011 04:13 PM
Maybe tonight...At 12. I'ma video santa and get my camera so see if he's real :)
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