|
| 25 Jan 2016 08:28 PM |
(this was tested with two people)
What the script is supposed to do: Put everyone onto teams Red and Blue, and give them swords. It is also supposed to change them back to the players team on death, and once one team is out of players they all are changed back to the players team and it restarts
What is happening: Put one person on blue team, and give the person on players team a sword
I am fairly new to for loops so the odds are im doing something wrong. Anyway, does anyone know what is going wrong? And if so, how can i fix it?
Script:
gameon = false game.Players.PlayerAdded:connect(function(startteam) startteam.TeamColor = BrickColor.new("Eggplant") end)
local function setgame() local players = game.Players:GetPlayers() local teams = {BrickColor.new("Really red"), BrickColor.new("Really blue")} for key = 1, #players do table.remove(players,math.random(#players)).TeamColor = teams[key % 2 + 1] local player = table.remove(players, math.random(#players)) local tool = game.ServerStorage.ClassicSword tool:Clone().Parent = player.Backpack while gameon do wait() local bp = game.Teams.BlueTeam:GetChildren() local rp = game.Teams.RedTeam:GetChildren() if #bp == 0 then for b = 1, #bp do table.remove(bp).TeamColor = BrickColor.new("Eggplant") end gameon = false end if #rp == 0 then for r = 1, #rp do table.remove(rp).TeamColor = BrickColor.new("Eggplant") end gameon = false end end end end
while true do wait() if not gameon then wait(10) local players = game.Players:GetChildren() if #players > 1 then gameon = true setgame() end end end
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Character) Character.Humanoid.Died:connect(function() Player.TeamColor = BrickColor.new("Eggplant") end) end) end) |
|
|
| Report Abuse |
|
|
|
| 25 Jan 2016 08:32 PM |
Wrong sub-forum. Go to Scripters.
|
|
|
| Report Abuse |
|
|
Metology
|
  |
| Joined: 06 Oct 2014 |
| Total Posts: 3255 |
|
|
| 25 Jan 2016 08:40 PM |
This is the right sub - forum nub
ish de squid weal |
|
|
| Report Abuse |
|
|
|
| 25 Jan 2016 08:41 PM |
In theory this is the right sub-forum.
In practice it is not.
I also recommend Scripters.
Much love -GO |
|
|
| Report Abuse |
|
|
|
| 25 Jan 2016 09:07 PM |
Scripters: This is the place for discussion about scripting. Anything about scripting that is not a help request or topic belongs here.
Game Design: This is the forum to get help, talk about future ROBLOX game ideas, or gather an awesome building team.
Game Marketing: This is where you show off your awesome creations, talk about how to advertise your game or share your marketing and sale tactics.
Game design is the only topic for getting help. |
|
|
| Report Abuse |
|
|
|
| 25 Jan 2016 09:19 PM |
I'll re-phrase.
Game Design was intended for help topics of all sort, while Scripters was not. It ended up that 95% of all scripting help posts ended up in Scripters.
Thus, I once again recommend Scripters.
Much love -GO |
|
|
| Report Abuse |
|
|
|
| 26 Jan 2016 06:28 PM |
| that makes more sense. i will post it there instead |
|
|
| Report Abuse |
|
|
Metology
|
  |
| Joined: 06 Oct 2014 |
| Total Posts: 3255 |
|
|
| 26 Jan 2016 06:41 PM |
r
#code print ("ish de squid weal") |
|
|
| Report Abuse |
|
|
|
| 26 Jan 2016 07:53 PM |
| Its a stupid and technically broken system, but it works. |
|
|
| Report Abuse |
|
|