Need help for teleporting players

So I need help teleport the peoples to same part1 then to part2 and infinite[ not random. ]
Thanks!

local s = script.Stat
t = 0
while true do
	t = 10 --for intermission timer
	repeat
		t = t-1
		s.Value = "Selecting random Map.. "..t
		wait(1) --time for Game starting
	until t == 0
	s.Value = "Game starting!"
	wait(2)
	local plrs = game.Players:GetChildren()
	for i = 1,#plrs do
		local num = math.random(1,1)
		plrs[i].Character.Head.CFrame = CFrame.new(workspace.Teleports["Part"..num].Position)
	end
	t=250 --time for seconds left me is 10 so like 10 seconds left
	repeat
		t = t-1
		s.Value = "Next Round In.. "..t
		wait(1)
	until t ==0
end
3 Likes

Any errors? Also why are you doing the head just do the humanoid root part.

1 Like

Not errors idk im just doing pretty stupid

1 Like

At the top of your while true have a value called “partNumber” or something that you increment by 1 in your while true so that at every loop it goes up by 1 like that (didn’t test ) :

local s = script.Stat
local partNumber = 1
t = 0
while true do
	t = 10 --for intermission timer
	repeat
		t = t-1
		s.Value = "Selecting random Map.. "..t
		wait(1) --time for Game starting
	until t == 0
	s.Value = "Game starting!"
	wait(2)
	local plrs = game.Players:GetChildren()
	for i = 1,#plrs do
		plrs[i].Character.Head.CFrame = CFrame.new(workspace.Teleports["Part"..partNumber].Position)
	end
       partNumber = partNumber + 1
	t=250 --time for seconds left me is 10 so like 10 seconds left
	repeat
		t = t-1
		s.Value = "Next Round In.. "..t
		wait(1)
	until t ==0
end
2 Likes

Maybe something like that, think so

1 Like

Are you sure there isn’t anything in output? From the look if it you should be at least receiving an error for trying to concatenate a string with a number on this line.

plrs[i].Character.Head.CFrame = CFrame.new(workspace.Teleports["Part"..num].Position)
1 Like

Remove the num variable and choose a part to teleport to.

3 Likes

how i like make the script do you know?

1 Like

You have to move the rootpart of the character heres the code just paste it.

local s = script.Stat
t = 0
while true do
	t = 10 --for intermission timer
	repeat
		t = t-1
		s.Value = "Selecting random Map.. "..t
		wait(1) --time for Game starting
	until t == 0
	s.Value = "Game starting!"
	wait(2)
	local plrs = game.Players:GetChildren()
	for i = 1,#plrs do
		local num = math.random(1,1)
		plrs[i].Character.HumanoidRootPart.CFrame = CFrame.new(workspace.Teleports["Part"..num].Position)
	end
	t=250 --time for seconds left me is 10 so like 10 seconds left
	repeat
		t = t-1
		s.Value = "Next Round In.. "..t
		wait(1)
	until t ==0
end

Hey do0gdemon! This is the line you’ll want to adjust:

Since i increases for each player, you can just simply concatenate that iterator to your target part name:

for i = 1,#plrs do
	plrs[i].Character.Head.CFrame = CFrame.new(workspace.Teleports["Part"..i].Position)
end

Hope this helps!

1 Like

if youre not trying to teleport to a random part then just
local num = i
im on a mobile device so i cant take the whole code and do formatting rn

local s = script.Stat
local partNumber = 1
t = 0
while true do
t = 10 --for intermission timer
repeat
t = t-1
s.Value = "Selecting random Map… "…t
wait(1) --time for Game starting
until t == 0
s.Value = “Game starting!”
wait(2)
local plrs = game.Players:GetChildren()
for i = 1,#plrs do
plrs[i].Character.Head.CFrame = CFrame.new(workspace.Teleports[“Part”…partNumber].Position)
end
partNumber = partNumber + 1
t=250 --time for seconds left me is 10 so like 10 seconds left
repeat
t = t-1
s.Value = "Next Round In… "…t
wait(1)
until t ==0
end

I think this is the solution

1 Like

yes that is what i was trying to say, also i couldnt understand you on your previous thread due to your broken english, sorry

Lol, yes my english is pretty trash!

1 Like