Help with a teleport script

Hello community, this script is about teleporting only the player, who counts down until he teleports, but it doesn’t work for me and I don’t have any error in the output, who can help me, please?

game.Players.PlayerAdded:Connect(function()
local msg = game.ReplicatedStorage.RoundMessage
	wait(2)
	for i = 35,0,-1 do
	msg.Value = "💥 Play At "..i
		wait(1)
		if i == 0 then
			print('Intermission Finished')

			local part = game.Workspace.Zone 
			for _, player in ipairs(game.Players.LocalPlayer.LocalPlayer)do
				player.Character:MoveTo(part.Position)
				wait(0)
				local msg = game.ReplicatedStorage.LobbyMessage
				wait(2)

						local part2 = game.Workspace.Zone2 
						for _, player in ipairs(game.Players.LocalPlayer.LocalPlayer) do
							player.Character:MoveTo(part2.Position)

						end
					end
		end
	end
end)

please, i need help with it :slight_smile:

Does it print? Also instead of

Try this:

player.Character.HumanoidRootPart.Position = part.Position
1 Like

Do not teleport me, what do i do?

Did it print (‘Intermission Finished’)? Also add prints before the teleport line and see if it triggers.

Screenshot_42

error in line 11

game.Players.PlayerAdded:Connect(function()
local msg = game.ReplicatedStorage.RoundMessage
	wait(2)
	for i = 35,0,-1 do -- Cambia el 5 por el tiempo que quieres que dure la intermission hacia el juego
	msg.Value = "💥 Play At "..i
		wait(1)
		if i == 0 then
			print('Intermission Finished')

			local part = game.Workspace.Zone --Cambia el 'Zone' por el nombre de su bloque
			for _, player in ipairs(game.Players.LocalPlayer)do
				print('YeahOne')
				player.Character.HumanoidRootPart.Position = part.Position
				wait(0)
				local msg = game.ReplicatedStorage.LobbyMessage
				wait(2)

						local part2 = game.Workspace.Zone2 --Cambia el 'Zone2' por el nombre de su bloque
				for _, player in ipairs(game.Players.LocalPlayer) do
					print('YeahTwo')
					player.Character.HumanoidRootPart.Position = part2.Position

						end
					end
		end
	end
end)

error in

for _, player in ipairs(game.Players.LocalPlayer)do

ipairs requires a table. You are telling it to loop through one person. Replace that line with:

for _, player in ipairs(game.Players:GetChildren())do

Change this:

For this:

game:GetService("Players").PlayerAdded:Connect(function(player)

And remove this:

And an end

Remove for _, player in ipairs(game.Players.LocalPlayer) do, and I put End and error output

One question, do you want the same player to move to part and then to part2?

mmm Not just one place, Zone :slight_smile:

look at this:

game:GetService("Players").PlayerAdded:Connect(function(player)
local msg = game.ReplicatedStorage.RoundMessage
	wait(2)
	for i = 35,0,-1 do 
	msg.Value = "💥 Play At "..i
		wait(1)
		if i == 0 then
			print('Intermission Finished')

			local part = game.Workspace.Zone 
				print('YeahOne')
				player.Character.HumanoidRootPart.Position = part.Position
				wait(0)
				local msg = game.ReplicatedStorage.LobbyMessage
				wait(2)
		end
	end
end)

If you change this:

For this:

player.Character:MoveTo(part.Position)

It works, but I don’t know if it’s what you want.

Very good idea, but this is in every Player? or All Players?

I think I already understood xd
Do you want all the players to move to that area?
If so, change this:

For this:

for i,player in pairs(Players:GetPlayers()) do
    player.Character:MoveTo(part.Position)
end

And remove the player in:

Oh no, no no xd, it was only for one person not for all the players. Does it mean that it already works?

Leaving it as before, it should work from what I understood.

Thanks You, For Help me <3 :slight_smile:

1 Like