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 » Scripters
Home Search
 

Re: Script

Previous Thread :: Next Thread 
Incrility is not online. Incrility
Joined: 11 Sep 2014
Total Posts: 161
23 Dec 2014 01:35 AM
Hey guys i need help with a script that takes all players from white and places them on the RED or BLUE team (Colors "really red" and "really blue") and then the script must make sure that the teams are balanced ive tried some combiinations but no positive outcomes
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
23 Dec 2014 01:37 AM
You messaged me, sorry I cant help you.
I've never used teams before and I am busy working on my own stuff atm to figure it out.
Report Abuse
Incrility is not online. Incrility
Joined: 11 Sep 2014
Total Posts: 161
23 Dec 2014 01:38 AM
Ive tried to combine some of this:




function RebalanceTeams(...)
local chosen = {...}
for i,v in pairs(chosen) do
if ((type(v) ~= "userdata") or ((type(v) == "userdata" and not v:IsA("Team")))) then
table.remove(chosen,i)
end
end
local teams = (#chosen > 0 and chosen or game:GetService("Teams"):GetTeams()) -- Get the teams. If none were given via arguments, collect all teams
local function onTeam(plr)
for _,v in pairs(teams) do
if (plr.TeamColor == v.TeamColor) then return true end
end
end
local plrs = game.Players:GetPlayers()
for i,p in pairs(plrs) do
if (not onTeam(p)) then table.remove(plrs,i) end
end
while (#plrs > 0) do
for _,t in pairs(teams) do

if (#plrs == 0) then break end
local ind = math.random(1,#plrs)
local p = plrs[ind]
p.TeamColor = t.TeamColor
table.remove(plrs,ind)
end
wait()
end


With some of this stuff"

function balanceteams()
local player = game.Players:GetChildren()
if player == game.Teams("White") then

end
end




PLZ HELP
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
23 Dec 2014 01:47 AM
function reteam()
local x = 0
for _, player in next, game.Players:GetPlayers() do
if ((player.TeamColor == BrickColor.new("White")) and ((x % 2) == 0)) then
player.TeamColor = BrickColor.new("Bright blue")
x = (x + 1)
elseif (player.TeamColor == BrickColor.new("White") then
player.TeamColor = BrickColor.new("Bright red")
x = (x + 1)
end
end
end
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
23 Dec 2014 01:53 AM
local function reteam()
local x = 0
for _, player in next, game.Players:GetPlayers() do
x = (x + ((player.TeamColor == BrickColor.new("White")) and 1 or 0)
player.TeamColor = BrickColor.new((player.TeamColor ~= BrickColor.new("White")) and player.TeamColor.Name or (((x % 2) == 0) and "Bright blue" or "Bright red"))
end
end
Report Abuse
Incrility is not online. Incrility
Joined: 11 Sep 2014
Total Posts: 161
23 Dec 2014 02:17 AM
which one should i use?
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
23 Dec 2014 02:17 AM
Both should work, I put a little more thought into the second one
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
23 Dec 2014 02:18 AM
You could also replace this

local x = 0


with

local x = math.random(2)

To add a little randomness to it P;
Report Abuse
Incrility is not online. Incrility
Joined: 11 Sep 2014
Total Posts: 161
23 Dec 2014 02:21 AM
WILL THIS WORK


local function reteam()
local x = 0
for _, player in next, game.Players:GetPlayers() do
x = (x + ((player.TeamColor == BrickColor.new("White")) and 1 or 0))
player.TeamColor = BrickColor.new((player.TeamColor ~= BrickColor.new("White")) and player.TeamColor.Name or (((x % 2) == 0) and "Really Blue" or "Really red"))
end
end


local admins = {"Incrility"}

function tableContains(t, value)
for _, v in pairs(t) do
if v == value then
return true
end
end
return false
end

function onChatted(message, player)
if message == "!setmode rcl" and tableContains(admins, player.Name) then
local function reteam()
end
end
end
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
23 Dec 2014 02:22 AM
Change this

function onChatted(message, player)
if message == "!setmode rcl" and tableContains(admins, player.Name) then
local function reteam()
end
end
end


to this


function onChatted(message, player)
if message == "!setmode rcl" and tableContains(admins, player.Name) then
reteam()
end
end


and maybe
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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