Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I have a teleport problem in my game and can someone please give me a good answer?

So in my game, I have it to where anywhere from 2-10 players are teleported to a certain position. The only problem is, only 1 player will teleport there. I'm not sure whats wrong and I've tried several different things.

Script:

local map = math.random(1,2) local player = game.Players:GetPlayers( ) msg = Instance.new("Message") msg.Parent = nil for i = 1, #player do

if map == 1 then msg.Parent = game.Workspace msg.Text = "Choosing Map..." wait(3) msg.Text = "Map Chosen: Classic" wait(3) msg.Text = "Loading." wait(1) msg.Text = "Loading.." wait(1) msg.Text = "Loading..." wait(1) msg.Text = "Loading." wait(1) msg.Text = "Loading.." wait(1) msg.Text = "Loading..." wait(2) msg:remove() game.Lighting.LinkedSword:clone().Parent = player[i].Backpack game.Lighting.RocketLauncher:clone().Parent = player[i].Backpack game.Workspace.Sounds.Intermission:Stop() game.Workspace.Sounds.Arena:Play() player[i].Character:MoveTo(Vector3.new(-486.5, -17.19, 486.5)) (more after this)

This script only teleported 1 player out of 3 players in the game. Also 1 of 2. I then tried a second script to see if I had any luck and I didn't. Here it is:

local map = math.random(1,2) local player = game.Players:GetPlayers( ) msg = Instance.new("Message") msg.Parent = nil for i = game.Players.NumPlayers, #player do

if map == 1 then msg.Parent = game.Workspace msg.Text = "Choosing Map..." wait(3) msg.Text = "Map Chosen: Classic" wait(3) msg.Text = "Loading." wait(1) msg.Text = "Loading.." wait(1) msg.Text = "Loading..." wait(1) msg.Text = "Loading." wait(1) msg.Text = "Loading.." wait(1) msg.Text = "Loading..." wait(2) msg:remove() game.Lighting.LinkedSword:clone().Parent = player[i].Backpack game.Lighting.RocketLauncher:clone().Parent = player[i].Backpack game.Workspace.Sounds.Intermission:Stop() game.Workspace.Sounds.Arena:Play() player[i].Character:MoveTo(Vector3.new(-486.5, -17.19, 486.5)) (more after this)

1 comment

0

Sorry I don't know how to put this in scripting format.

1 answer

✓ Accepted answer

Tried doin somethin like this?

for i,v in pairs(player) do
	if game.Workspace:FindFirstChild(v.Name) then
		v.Character.Torso.CFrame = CFrame.new(PartsNameYouWantThemToTpTo.CFrame + Vector3.new(0,2,0))
	end
end

Btw click the little lua icon to put it in the scripting format.

3 comments

0

Doesn't seem to work, I want to have several different maps and this one only teleports you to the one map with the part right?

0

Yes but that is just because I thought you wanted to tp all players to the same part in a map. You could always add a script that removes and adds a map to the workspace and put the same part with the same name in each map to fix this.

0

That script does break my entire script however...

This discussion is preserved as it was. New answers, comments, and votes are closed.