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: Anything Wrong With This?

Previous Thread :: Next Thread 
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
25 Jul 2014 01:06 PM
repeat wait() until #game.Players:GetPlayers() > 4
game.Workspace.WaitingForPlayersMessage:Destroy()
game.Lighting.AssigningRolesMessage:Clone().Parent = game.Workspace
if #game.Players:GetPlayers() > 4 then
local players = game.Players:GetPlayers();
local scientists = {}
local alien1 = players[math.random(1, #players)];
local alien2 = players[math.random(1, #players)];
table.remove(players, alien1);
table.remove(players, alien2);
local medic = players[math.random(1, #players)];
local military = players[math.random(1, #players)];
table.remove(players, medic);
table.remove(players, military);
for i, v in pairs(players) do
if v then
table.insert(scientists, v);
alien1.Character.Torso.CFrame = CFrame.new(Vector3.new(0, 0, 0))
alien2.Character.Torso.CFrame = CFrame.new(Vector3.new(0, 0, 0))
medic.Character.Torso.CFrame = CFrame.new(Vector3.new(0, 0, 0))
guard.Character.Torso.CFrame = CFrame.new(Vector3.new(0, 0, 0))
game.Lighting.MilitaryTool:Clone().Parent = military.Backpack
game.Lighting.MedicTool:Clone().Parent = medic.Backpack
if alien1.Character:FindFirstChild("Shirt") then char:FindFirstChild("Shirt"):Destroy() end
if alien2.Character:FindFirstChild("Shirt") then char:FindFirstChild("Shirt"):Destroy() end
if medic.Character:FindFirstChild("Shirt") then char:FindFirstChild("Shirt"):Destroy() end
if military.Character:FindFirstChild("Shirt") then char:FindFirstChild("Shirt"):Destroy() end
if alien1.Character:FindFirstChild("Pants") then char:FindFirstChild("Pants"):Destroy() end
if alien2.Character:FindFirstChild("Pants") then char:FindFirstChild("Pants"):Destroy() end
if medic.Character:FindFirstChild("Pants") then char:FindFirstChild("Pants"):Destroy() end
if military.Character:FindFirstChild("Pants") then char:FindFirstChild("Pants"):Destroy() end
a = Instance.new("Shirt",military.Character)
a.Name = MilitaryShirt
a.ShirtTemplate = "http://www.roblox.com/asset/?id=162950220"
b = Instance.new("Shirt",military.Character)
b.Name = MilitaryPants
b.ShirtTemplate = "http://www.roblox.com/asset/?id=162951789"
end;
end;
end
Report Abuse
ediee544 is not online. ediee544
Joined: 24 Oct 2008
Total Posts: 2175
25 Jul 2014 01:06 PM
Yes, it's too long.
Report Abuse
ediee544 is not online. ediee544
Joined: 24 Oct 2008
Total Posts: 2175
25 Jul 2014 01:08 PM
I don't see any errors, is there output?
Report Abuse
EkoGam3 is not online. EkoGam3
Joined: 25 Mar 2011
Total Posts: 343
25 Jul 2014 01:11 PM
The ID's for shirts and pants should always be subtracted by one. And to get the total players in the game, it's game.Players.NumPlayers. I wouldn't put all the semicolons either, but that's just me. They're not necessary.

repeat wait() until game.Players.NumPlayers > 4
game.Workspace.WaitingForPlayersMessage:Destroy()
game.Lighting.AssigningRolesMessage:Clone().Parent = game.Workspace
if game.Players.NumPlayers > 4 then
local players = game.Players:GetPlayers();
local scientists = {}
local alien1 = players[math.random(1, #players)];
local alien2 = players[math.random(1, #players)];
table.remove(players, alien1);
table.remove(players, alien2);
local medic = players[math.random(1, #players)];
local military = players[math.random(1, #players)];
table.remove(players, medic);
table.remove(players, military);
for i, v in pairs(players) do
if v then
table.insert(scientists, v);
alien1.Character.Torso.CFrame = CFrame.new(Vector3.new(0, 0, 0))
alien2.Character.Torso.CFrame = CFrame.new(Vector3.new(0, 0, 0))
medic.Character.Torso.CFrame = CFrame.new(Vector3.new(0, 0, 0))
guard.Character.Torso.CFrame = CFrame.new(Vector3.new(0, 0, 0))
game.Lighting.MilitaryTool:Clone().Parent = military.Backpack
game.Lighting.MedicTool:Clone().Parent = medic.Backpack
if alien1.Character:FindFirstChild("Shirt") then char:FindFirstChild("Shirt"):Destroy() end
if alien2.Character:FindFirstChild("Shirt") then char:FindFirstChild("Shirt"):Destroy() end
if medic.Character:FindFirstChild("Shirt") then char:FindFirstChild("Shirt"):Destroy() end
if military.Character:FindFirstChild("Shirt") then char:FindFirstChild("Shirt"):Destroy() end
if alien1.Character:FindFirstChild("Pants") then char:FindFirstChild("Pants"):Destroy() end
if alien2.Character:FindFirstChild("Pants") then char:FindFirstChild("Pants"):Destroy() end
if medic.Character:FindFirstChild("Pants") then char:FindFirstChild("Pants"):Destroy() end
if military.Character:FindFirstChild("Pants") then char:FindFirstChild("Pants"):Destroy() end
a = Instance.new("Shirt",military.Character)
a.Name = MilitaryShirt
a.ShirtTemplate = "http://www.roblox.com/asset/?id=162950219"
b = Instance.new("Shirt",military.Character)
b.Name = MilitaryPants
b.ShirtTemplate = "http://www.roblox.com/asset/?id=162951788"
end;
end;
end
Report Abuse
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
25 Jul 2014 01:55 PM
Thanks
Report Abuse
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
25 Jul 2014 01:56 PM
Also, what would be the easiest way to give all the scientists, a shirt and pants and teleport them?
Report Abuse
fret13103 is not online. fret13103
Joined: 15 Mar 2010
Total Posts: 881
25 Jul 2014 01:56 PM
By sorting them into a table.
Report Abuse
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
25 Jul 2014 03:10 PM
I did but how would I teleport them and give them shirts and pants?
Report Abuse
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
25 Jul 2014 03:53 PM
bump
Report Abuse
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
26 Jul 2014 05:38 AM
bump2
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