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: This only teleports some players...

Previous Thread :: Next Thread 
PennslyvaniaRoadGeek is not online. PennslyvaniaRoadGeek
Joined: 06 Jan 2012
Total Posts: 404
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
PennslyvaniaRoadGeek is not online. PennslyvaniaRoadGeek
Joined: 06 Jan 2012
Total Posts: 404
06 Oct 2016 07:41 PM
b1
Report Abuse
TheShadowMessage is not online. TheShadowMessage
Joined: 21 Sep 2012
Total Posts: 10379
06 Oct 2016 07:46 PM
dont use in pairs?
Report Abuse
PennslyvaniaRoadGeek is not online. PennslyvaniaRoadGeek
Joined: 06 Jan 2012
Total Posts: 404
06 Oct 2016 07:48 PM
Lol thats impossible
Report Abuse
zdravstvuy is not online. zdravstvuy
Joined: 25 Sep 2016
Total Posts: 6
06 Oct 2016 07:49 PM
whats the output noob
Report Abuse
PennslyvaniaRoadGeek is not online. PennslyvaniaRoadGeek
Joined: 06 Jan 2012
Total Posts: 404
06 Oct 2016 07:54 PM
Lol "noob" Just leave...
Report Abuse
Lem0nzzx is not online. 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 is not online. 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 is not online. 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 is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
06 Oct 2016 08:02 PM
If it works, it's good.


Report Abuse
DevVince is not online. 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 is not online. 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
PennslyvaniaRoadGeek is not online. PennslyvaniaRoadGeek
Joined: 06 Jan 2012
Total Posts: 404
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 is not online. 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 is not online. 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 is not online. 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
PennslyvaniaRoadGeek is not online. PennslyvaniaRoadGeek
Joined: 06 Jan 2012
Total Posts: 404
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
zdravstvuy is not online. zdravstvuy
Joined: 25 Sep 2016
Total Posts: 6
07 Oct 2016 04:06 PM
u r the biggest noob
Report Abuse
PennslyvaniaRoadGeek is not online. PennslyvaniaRoadGeek
Joined: 06 Jan 2012
Total Posts: 404
07 Oct 2016 06:17 PM
Lol dude... at least i have clothes/hats...
Report Abuse
PennslyvaniaRoadGeek is not online. PennslyvaniaRoadGeek
Joined: 06 Jan 2012
Total Posts: 404
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 is not online. 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
PennslyvaniaRoadGeek is not online. PennslyvaniaRoadGeek
Joined: 06 Jan 2012
Total Posts: 404
07 Oct 2016 10:45 PM
Looks promising actually...
Report Abuse
PennslyvaniaRoadGeek is not online. PennslyvaniaRoadGeek
Joined: 06 Jan 2012
Total Posts: 404
07 Oct 2016 10:48 PM
THANK YOU! Finally... Appreciate the help... You are da man/legend C:
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