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)
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.