Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago

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)

0
Sorry I don't know how to put this in scripting format. CardboardedCharacter 53 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

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.

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? CardboardedCharacter 53 — 8y
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. spyro10jf 27 — 8y
0
That script does break my entire script however... CardboardedCharacter 53 — 8y
Ad

Answer this question