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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Game Design
Home Search
 

Re: What is wrong with this script?

Previous Thread :: Next Thread 
JarheadTech is not online. JarheadTech
Joined: 05 Oct 2015
Total Posts: 310
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
TheElectricMinecraft is not online. TheElectricMinecraft
Joined: 23 Nov 2012
Total Posts: 113
25 Jan 2016 08:32 PM
Wrong sub-forum. Go to Scripters.
Report Abuse
Metology is not online. 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
GreatOculus is not online. GreatOculus
Joined: 30 Aug 2009
Total Posts: 2103
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
JarheadTech is not online. JarheadTech
Joined: 05 Oct 2015
Total Posts: 310
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
GreatOculus is not online. GreatOculus
Joined: 30 Aug 2009
Total Posts: 2103
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
JarheadTech is not online. JarheadTech
Joined: 05 Oct 2015
Total Posts: 310
26 Jan 2016 06:28 PM
that makes more sense. i will post it there instead
Report Abuse
Metology is not online. Metology
Joined: 06 Oct 2014
Total Posts: 3255
26 Jan 2016 06:41 PM
r


#code print ("ish de squid weal")
Report Abuse
tornadozebra is not online. tornadozebra
Joined: 02 Oct 2011
Total Posts: 316
26 Jan 2016 07:53 PM
Its a stupid and technically broken system, but it works.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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