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: Auto-Assigning players script not working?

Previous Thread :: Next Thread 
truefire2 is not online. truefire2
Joined: 04 Jul 2010
Total Posts: 5330
25 Feb 2014 02:16 PM
Hi, I'm creating a script of which players join the game then join the team which is losing. However, it doesn't seem to work. How do I fix this? There is no output.

local Plrs = game.Players

function checkTeams()
local kills_r,deaths_r,kdr_r
local kills_b,deaths_b,kdr_b
for _, v in pairs(Plrs:GetPlayers()) do
if v.TeamColor == BrickColor.new("Bright blue") then
deaths_b = v:FindFirstChild("leaderstats") and v["leaderstats"]:FindFirstChild("Wipeouts") and v["leaderstats"]["Wipeouts"].Value + deaths_b
kdr_b = (kills_b/deaths_b ~= 0 and deaths_b or 1)
elseif v.TeamColor == BrickColor.new("Bright red") then
deaths_b = v:FindFirstChild("leaderstats") and v["leaderstats"]:FindFirstChild("Wipeouts") and v["leaderstats"]["Wipeouts"].Value + deaths_r
kdr_r = (kills_r/deaths_r ~= 0 and deaths_r or 1)
end
end
return kdr_r,kdr_b
end

Plrs.PlayerAdded:connect(function(plr)
if Workspace.MapHolder:GetChildren()[1] then
kdr_r,kdr_b= checkTeams()
if kdr_r > kdr_b then
plr.TeamColor = BrickColor.new("Bright red")
plr:LoadCharacter()
elseif kdr_b > kdr_r then
plr.TeamColor = BrickColor.new("Bright blue")
plr:LoadCharacter()
end
end
end)
Report Abuse
truefire2 is not online. truefire2
Joined: 04 Jul 2010
Total Posts: 5330
25 Feb 2014 02:33 PM
bump
Report Abuse
GiganticGulian is not online. GiganticGulian
Joined: 18 Feb 2011
Total Posts: 2233
25 Feb 2014 03:22 PM
run it with a lot of print('randomstuff')
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