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

Minigame map spawning script not working?

Asked by 5 years ago

So I'm trying to make the players from each team to spawn at each random part from a spawn group position in each map that spawns. This is the code I have so far:

Players.PlayerAdded:Connect(function(player)

local mapd = game.ServerStorage.Maps:FindFirstChild("BasicMap")
local bluespawns = mapd:FindFirstChild("BlueSpawns"):GetChildren()[math.random(1,6)]
local yellowspawns = mapd:FindFirstChild("YellowSpawns"):GetChildren()[math.random(1,6)]
local bluetarget = CFrame.new(472.672, 0.363, 64.623)
local yellowtarget = CFrame.new(434.852, 0.363, 329.673)

for i, player in ipairs(game.Players:GetChildren()) do
   if player.Character and player.Character:FindFirstChild("Torso") then
    if player.Team == game:GetService("Teams").Blue then

      player.Character:WaitForChild('Torso').CFrame = CFrame.new(bluespawns.Position + Vector3.new(0,2.5,0))

    elseif player.Team == game:GetService("Teams").Yellow then

      player.Character:WaitForChild('Torso').CFrame = CFrame.new(yellowspawns.Position + Vector3.new(0,2.5,0))

   end
end
end
end)

It works locally but not in-game/FE, please help!

0
is this a local script because you cant use playeradded on it User#23365 30 — 5y
0
more information: errors, if any? type of script & location green271 635 — 5y
0
Oh sorry, there is no errors through the output and this is a normal script in the serverscriptservice. IsaacThePooper 0 — 5y
0
Do you have a spawns folder? D3VRO 66 — 5y

Answer this question