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: I DONT UNDERSTAND

Previous Thread :: Next Thread 
devTools is not online. devTools
Joined: 06 Sep 2014
Total Posts: 7950
11 Sep 2014 04:56 PM
What did I do wrong?

What it's supposed to do:
-Team Random Players to the teams and make sure that the maximum of players on the "Noobs" team is 4 and it has contitionals if there are specific numbers of players.
-Randomly Load Maps
-Change the team's speed

What it does:
-Loads a map
-After the while true do loop at the end goes through the cycle once, THEN it organizes the teams. When it organizes the teams, it doesn't do it correct and when I had 3 people in a server it put us all on the "Noobs" team.
-It will change our speed if we are on the team (It did after the while true do did its second cycle), but if you reset it will go back to 16 speed.

The script:
--------------------

mapStorage = game.ServerStorage.Maps
mapHolder = mapStorage:GetChildren()
maps = {"Lava","Canyon","City","Ice","Marble","Mayhem","Pit"} -- Enter map names here in "" such as "Map_Name"

function GetPlayersOnTeam(teamColor)
local playersFound = {}
for _,v in ipairs(game.Players:GetPlayers()) do
if v.TeamColor == teamColor then
table.insert(playersFound,v)
end
end
return playersFound
end
noobsTeam = GetPlayersOnTeam(BrickColor.new("New Yeller"))
guestsTeam = GetPlayersOnTeam(BrickColor.new("Institutional white"))

function organizeTeams()
a = game.Players.NumPlayers
local Plyrs = game.Players:GetPlayers()
for i = 1, #Plyrs do
local rndom = table.remove(Plyrs, math.random(#Plyrs))
if a >= 2 then
rndom.TeamColor = BrickColor.new("New Yeller" or "Institutional white")
else Plyrs.TeamColor = BrickColor.new("Really black")
b = guestsTeam
c = noobsTeam
if #b == 2 or #b == 3 or #b == 4 or #b == 5 and #c < 1 then
rndom.TeamColor = BrickColor.new("New Yeller")
else if #b == 6 or #b == 7 or #b == 8 or #b == 9 or #b == 10 and #c < 2 then
rndom.TeamColor = BrickColor.new("New Yeller")
repeat until #c == 2
else if #b == 11 or #b == 12 or #b == 13 or #b == 14 or #b == 15 and #c < 3 then
rndom.TeamColor = BrickColor.new("New Yeller")
repeat until #c == 3
else if #b == 16 or #b == 17 or #b == 18 or #b == 19 or #b == 20 and #c < 4 then
rndom.TeamColor = BrickColor.new("New Yeller")
repeat until #c == 4

if #c == 2 and #b < 5 then
rndom.TeamColor = BrickColor.new("Institutional white")
repeat until #c == 1
else if #c == 3 and #b < 10 then
rndom.TeamColor = BrickColor.new("Institutional white")
repeat until #c == 2
else if #c == 4 and #b < 15 then
rndom.TeamColor = BrickColor.new("Institutional white")
repeat until #c == 3
else if #c >= 5 and #b < 20 then
rndom.TeamColor = BrickColor.new("Institutional white")
repeat until #c == 4

end
end
end
end
end
end
end
end
end
end
end

function Speed()
for i, v in pairs(game.Players:GetChildren()) do
if v.TeamColor == game.Teams.Guests.TeamColor then
v.Character.Humanoid.WalkSpeed = 35
end
end
for i, v in pairs(game.Players:GetChildren()) do
if v.TeamColor == game.Teams.Noobs.TeamColor then
v.Character.Humanoid.WalkSpeed = 40
end
end
end

function back()
for i, v in pairs(game.Players:GetChildren()) do
if v.TeamColor == game.Teams.Guests.TeamColor then
v.Character.Humanoid.WalkSpeed = 16
end
end
for i, v in pairs(game.Players:GetChildren()) do
if v.TeamColor == game.Teams.Noobs.TeamColor then
v.Character.Humanoid.WalkSpeed = 16
end
end
u = game.Players:GetChildren()
u.TeamColor = BrickColor.new("Really black")
end





while true do
wait(25)
if game.Players.NumPlayers >= 2 then
pickedMap = mapHolder[math.random(1, #maps)]
x = pickedMap:clone()
x.Parent = game.Workspace
x.Name = "Map"
organizeTeams()
Speed()
wait(240)
back()
game.Workspace.Map:remove()
end
end
--------------------

TL;DR
My script is working to an extent, but is not doing what I want it to do. Any advice?


|Seems legit | devTools
Report Abuse
devTools is not online. devTools
Joined: 06 Sep 2014
Total Posts: 7950
11 Sep 2014 05:14 PM
Anyone?
Report Abuse
devTools is not online. devTools
Joined: 06 Sep 2014
Total Posts: 7950
11 Sep 2014 05:31 PM
Bump
Report Abuse
xXScriptzXx is not online. xXScriptzXx
Joined: 13 Jan 2013
Total Posts: 4452
11 Sep 2014 05:35 PM
You are all noobs e.e
Thats why, its working correctly.

[Content Destroyed by Shedletsky]
Report Abuse
devTools is not online. devTools
Joined: 06 Sep 2014
Total Posts: 7950
11 Sep 2014 06:45 PM
Where in the script do you see it making game.Players:GetChildren().TeamColor = BrickColor.new("New Yeller")?


|Seems legit | devTools
Report Abuse
devTools is not online. devTools
Joined: 06 Sep 2014
Total Posts: 7950
11 Sep 2014 06:50 PM
Could this be the issue?
local rndom = table.remove(Plyrs, math.random(#Plyrs))
if a >= 2 then
rndom.TeamColor = BrickColor.new("New Yeller" or "Institutional white")

It might only be reading the first TeamColor instead of both. If so, how could I fix it? (I thought of this because I think "or" can only be used in if/then statements).


|Seems legit | devTools
Report Abuse
xXScriptzXx is not online. xXScriptzXx
Joined: 13 Jan 2013
Total Posts: 4452
11 Sep 2014 06:53 PM
dont use table.remove.

[Content Destroyed by Shedletsky]
Report Abuse
devTools is not online. devTools
Joined: 06 Sep 2014
Total Posts: 7950
11 Sep 2014 06:55 PM
What should I use instead?


|Seems legit | devTools
Report Abuse
xXScriptzXx is not online. xXScriptzXx
Joined: 13 Jan 2013
Total Posts: 4452
11 Sep 2014 06:56 PM
i dont remmember.

[Content Destroyed by Shedletsky]
Report Abuse
fruitygeneration is not online. fruitygeneration
Joined: 21 Mar 2012
Total Posts: 585
11 Sep 2014 06:57 PM
its table:remove()
Report Abuse
xXScriptzXx is not online. xXScriptzXx
Joined: 13 Jan 2013
Total Posts: 4452
11 Sep 2014 06:58 PM
w8
1 sec

[Content Destroyed by Shedletsky]
Report Abuse
devTools is not online. devTools
Joined: 06 Sep 2014
Total Posts: 7950
11 Sep 2014 06:59 PM
Does anyone else know?
Also, is the script only reading the first color?


|Seems legit | devTools
Report Abuse
xXScriptzXx is not online. xXScriptzXx
Joined: 13 Jan 2013
Total Posts: 4452
11 Sep 2014 07:01 PM
1 sec i will fix your script
Itr will be 48 hours

[Content Destroyed by Shedletsky]
Report Abuse
devTools is not online. devTools
Joined: 06 Sep 2014
Total Posts: 7950
11 Sep 2014 07:02 PM
Thanks!


|Seems legit | devTools
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
11 Sep 2014 07:05 PM
funny because your getting trolled by this guy lol
Report Abuse
xXScriptzXx is not online. xXScriptzXx
Joined: 13 Jan 2013
Total Posts: 4452
11 Sep 2014 07:06 PM
@Master No, I'm not trolling

;)

[Content Destroyed by Shedletsky]
Report Abuse
xXScriptzXx is not online. xXScriptzXx
Joined: 13 Jan 2013
Total Posts: 4452
11 Sep 2014 07:07 PM
Floodcheck
*:)

[Content Destroyed by Shedletsky]
Report Abuse
devTools is not online. devTools
Joined: 06 Sep 2014
Total Posts: 7950
11 Sep 2014 07:07 PM
Oh... gg.


|Seems legit | devTools
Report Abuse
FutureWebsiteOwner is not online. FutureWebsiteOwner
Joined: 29 Jul 2014
Total Posts: 468
11 Sep 2014 07:07 PM
@thread creator
you have got to stop reposting this and try to figure this out yourself, you have more info than us
Report Abuse
devTools is not online. devTools
Joined: 06 Sep 2014
Total Posts: 7950
11 Sep 2014 07:09 PM
I don't know how to figure it out, that's why I came here.


|Seems legit | devTools
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
11 Sep 2014 07:11 PM
because you had someone else make everything for you.
Report Abuse
devTools is not online. devTools
Joined: 06 Sep 2014
Total Posts: 7950
11 Sep 2014 07:12 PM
No, I just don't know how to fix the problem I am having. Can someone please help me and just stop complaining? Thanks.


|Seems legit | devTools
Report Abuse
FutureWebsiteOwner is not online. FutureWebsiteOwner
Joined: 29 Jul 2014
Total Posts: 468
11 Sep 2014 07:16 PM
i learned that once you cant find an answer here... it is a silly mistake somewhere that scripting helpers dont know about
Report Abuse
devTools is not online. devTools
Joined: 06 Sep 2014
Total Posts: 7950
11 Sep 2014 07:17 PM
Okay, i'll look. I am still thinking it is the "or" but I am not sure, so I made a new forum to ask.


|Seems legit | devTools
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