|
| 06 Oct 2016 07:17 PM |
This is a line from my master script. The teams are in lighting. When the game starts it clones 2 teams from lighting into game.Teams! away is the away team and home is the home team... So when this code works it works fine, yet it doesn't teleport everyone to the room. Please help! If you have any questions... ask!
for i,v in pairs(game.Players:GetChildren()) do if v.TeamColor==away.TeamColor then v.Character.Torso.CFrame=CFrame.new(92.212, 3.001, -49.616) else if v.TeamColor==home.TeamColor then v.Character.Torso.CFrame=CFrame.new(-92.308, 3.049, 361.391) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
| |
|
Lem0nzzx
|
  |
| Joined: 08 Feb 2016 |
| Total Posts: 1604 |
|
|
| 06 Oct 2016 07:57 PM |
You could always sort it out, by creating two seperate functions for each team.
function team1()
for _,v in pairs(game.Players:GetChildren()) do if v.TeamColor == "Really red" then end end end
function team2()
for _,v in pairs(game.Players:GetChildren()) do if v.TeamColor == "Really black" then end end end
team1() team2()
|
|
|
| Report Abuse |
|
|
Lem0nzzx
|
  |
| Joined: 08 Feb 2016 |
| Total Posts: 1604 |
|
|
| 06 Oct 2016 07:58 PM |
Oooopsies made a mistake.
function team1()
for _,v in pairs(game.Players:GetChildren()) do if v.TeamColor == BrickColor.new("Really red") then end end end
function team2()
for _,v in pairs(game.Players:GetChildren()) do if v.TeamColor == BrickColor.new("Really black") then end end end
team1() team2()
|
|
|
| Report Abuse |
|
|
sparker22
|
  |
| Joined: 11 Mar 2010 |
| Total Posts: 846 |
|
|
| 06 Oct 2016 08:00 PM |
@Lem0nzzx Thats unnecessary and uses more loops than you have to use.
@OP My first guess is that not all players are being detected to being on the proper team. for i,v in pairs(game.Players:GetChildren()) do if v.TeamColor==away.TeamColor then v.Character.Torso.CFrame=CFrame.new(92.212, 3.001, -49.616) elseif v.TeamColor==home.TeamColor then v.Character.Torso.CFrame=CFrame.new(-92.308, 3.049, 361.391) else print("Teamcolor not found") end end
See if it hits the else statement. |
|
|
| Report Abuse |
|
|
Lem0nzzx
|
  |
| Joined: 08 Feb 2016 |
| Total Posts: 1604 |
|
| |
|
DevVince
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 9245 |
|
|
| 06 Oct 2016 08:09 PM |
for i,v in pairs(game.Players:GetChildren()) do spawn(function() local c = v.Character repeat wait() until c local t = c:WaitForChild'HumanoidRootPart'--Might not be the right name. t.CFrame = v.TeamColor == away.TeamColor and CFrame.new(92.212, 3.001, -49.616) or CFrame.new(-92.308, 3.049, 361.391) end) end |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 06 Oct 2016 08:10 PM |
@Devince
no need to use spawn
and no one ever uses root. there is no point
just use torso
|
|
|
| Report Abuse |
|
|
|
| 06 Oct 2016 08:11 PM |
Ok.. so this is more of the code
randomTeams(); message("Time To Start The Game!",5); wait(7) game.Workspace.stadiummus:Play() for i,v in pairs(game.Players:GetChildren()) do if v.TeamColor==away.TeamColor then v.Character.Torso.CFrame=CFrame.new(92.212, 3.001, -49.616) else if v.TeamColor==home.TeamColor then v.Character.Torso.CFrame=CFrame.new(-92.308, 3.049, 361.391) wait(7) message("Here Are This Matchup's Teams!",5) wait(7) message((away.Name).." Is Your Away Team!",5); game.Workspace.awayroom.door.CanCollide = false game.Workspace.awayroom.door.Transparency = 1 wait(10) game.Workspace.awayroom.door.CanCollide = true game.Workspace.awayroom.door.Transparency = 0 wait(5) message("AND NOW",5); wait(7) message("Here Are Your "..home.Name,5); game.Workspace.homeroom.door.CanCollide = false game.Workspace.homeroom.door.Transparency = 1 wait(10) game.Workspace.homeroom.door.CanCollide = true game.Workspace.homeroom.door.Transparency = 0 game.Workspace.stadiummus:Stop() end end end
end end |
|
|
| Report Abuse |
|
|
DevVince
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 9245 |
|
|
| 06 Oct 2016 08:13 PM |
| I know it's so if a person joins or resets and their humanoid or anything is missing they will be teleported once respawned and there will be no delay, that's why I added the new threads. |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 06 Oct 2016 08:14 PM |
FOR THE LAST TIME I GAVE YOU WORKING CODE. YOU REFUSE TO USE MY SOLUTION. YOU REFUSE TO DEBUG YOUR CODE. YOU REFUSE TO LISTEN. YOU NEED TO PAY ATTENTION AT WHAT I'VE BEEN DOING. IT'S INSULTING BECAUSE YOU THINK YOU KNOW MORE WHEN YOU DON'T. LISTEN TO ME NEXT TIME AND IT WILL WORK.
|
|
|
| Report Abuse |
|
|
DevVince
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 9245 |
|
|
| 06 Oct 2016 08:18 PM |
You want to put this outside: (Like so)
for i,v in pairs(game.Players:GetChildren()) do spawn(function() local c = v.Character repeat wait() until c local t = c:WaitForChild'HumanoidRootPart'--Might not be the right name. t.CFrame = v.TeamColor == away.TeamColor and CFrame.new(92.2, 3, -49.6) or CFrame.new(-92.3, 3, 361.4) end) end wait(7) message("Theses are the matchup teams!", 5) wait(7) message((away.Name).." is the away team!",5) game.Workspace.awayroom.door.CanCollide = false game.Workspace.awayroom.door.Transparency = 1 wait(10) game.Workspace.awayroom.door.CanCollide = true game.Workspace.awayroom.door.Transparency = 0 wait(5) message("And now...",5) wait(7) message("This is the home team! "..home.Name,5) game.Workspace.homeroom.door.CanCollide = false game.Workspace.homeroom.door.Transparency = 1 wait(10) game.Workspace.homeroom.door.CanCollide = true game.Workspace.homeroom.door.Transparency = 0 game.Workspace.stadiummus:Stop() |
|
|
| Report Abuse |
|
|
|
| 06 Oct 2016 08:26 PM |
| @ticks YOUR CODE DIDN'T WORK ####### I HAVE WHOLE MASTER SCRIPT WITH OVER 1k LINES OF CODE! # PUT YOUR #### IN AND IT DIDN'T WORK... ## JUST #### OR HELP |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Oct 2016 06:17 PM |
| Lol dude... at least i have clothes/hats... |
|
|
| Report Abuse |
|
|
|
| 07 Oct 2016 10:33 PM |
Would this work?
for _,v in pairs(game.Players:GetChildren()) do if v.TeamColor==away.TeamColor then v.Character.Torso.CFrame=CFrame.new(92.212, 3.001, -49.616) wait(1) player=v.Character.Torso.CFrame==CFrame.new(92.212, 3.001, -49.616)+1 repeat until player==5 elseif v.TeamColor==home.TeamColor then v.Character.Torso.CFrame=CFrame.new(-92.308, 3.049, 361.391) wait(1) player1=v.Character.Torso.CFrame==CFrame.new(-92.308, 3.049, 361.391)+1 repeat until player1==5 wait(7) |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 07 Oct 2016 10:43 PM |
randomTeams() message("Time To Start The Game!",5) wait(7) workspace.stadiummus:Play()
for i,v in next, game.Players:GetPlayers() do if v.TeamColor == away.TeamColor then v.Character.Torso.CFrame = CFrame.new(92.212,3.001,-49.616) elseif v.TeamColor == home.TeamColor then v.Character.Torso.CFrame = CFrame.new(-92.308,3.049,361.391) end end
wait(7) message("Here Are This Matchup's Teams!",5) wait(7) message((away.Name).." Is Your Away Team!",5); workspace.awayroom.door.CanCollide = false workspace.awayroom.door.Transparency = 1 wait(10) workspace.awayroom.door.CanCollide = true workspace.awayroom.door.Transparency = 0 wait(5) message("AND NOW",5); wait(7) message("Here Are Your "..home.Name,5); workspace.homeroom.door.CanCollide = false workspace.homeroom.door.Transparency = 1 wait(10) workspace.homeroom.door.CanCollide = true workspace.homeroom.door.Transparency = 0 workspace.stadiummus:Stop()
|
|
|
| Report Abuse |
|
|
|
| 07 Oct 2016 10:45 PM |
| Looks promising actually... |
|
|
| Report Abuse |
|
|
|
| 07 Oct 2016 10:48 PM |
| THANK YOU! Finally... Appreciate the help... You are da man/legend C: |
|
|
| Report Abuse |
|
|