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

how do i make this script spawn where i want them?

Asked by 8 years ago

these are the scripts i have tried. it doesnt spawn on the first spawn. it spawns on the second spawn. i have 5 red spawns and 5 blue spawns

what im trying to do is make one person spawn on red, then second person on blue and third on red, and so on. please help!

game.Players.PlayerAdded:connect(function(player)



    if game.Teams["Blue Team"].Number.Value <= game.Teams["Red Team"].Number.Value then
    player.TeamColor = BrickColor.new ("Really red")

        if game.Workspace.Red.Red1.Used == false then
            spawn()


        end
    end

    game.Teams["Red Team"].Number.Value = game.Teams["Red Team"].Number.Value  + 1

    if game.Teams["Red Team"].Number.Value <= game.Teams["Blue Team"].Number.Value then
    player.TeamColor = BrickColor.new ("Really blue")
    game.Teams["Blue Team"].Number.Value = game.Teams["Blue Team"].Number.Value  + 1



-- count how many players are on each team
local teams = game:GetService("Teams"):GetTeams()
for _, team in pairs(teams) do
    local players = team:GetPlayers()

    print("Team " .. team.Name .. " has " .. #players .. " players")




    end
    end
    end)

game.Players.PlayerAdded:connect(function(player)



    if game.Teams["Blue Team"].Number.Value <= game.Teams["Red Team"].Number.Value then
    player.TeamColor = BrickColor.new ("Really red")
    for i,v in pairs(game.Workspace.Red:GetChildren()) do
        if v.Used == false then
            spawn(v)


        end
    end

    game.Teams["Red Team"].Number.Value = game.Teams["Red Team"].Number.Value  + 1
    else
    if game.Teams["Red Team"].Number.Value <= game.Teams["Blue Team"].Number.Value then
    player.TeamColor = BrickColor.new ("Really blue")
    game.Teams["Blue Team"].Number.Value = game.Teams["Blue Team"].Number.Value  + 1



-- count how many players are on each team
local teams = game:GetService("Teams"):GetTeams()
for _, team in pairs(teams) do
    local players = team:GetPlayers()

    print("Team " .. team.Name .. " has " .. #players .. " players")




    end
    end
    end
end)

1 answer

Log in to vote
0
Answered by 8 years ago

Honestly, a script isn't needed for the player to spawn in a certain location. Insert a "Spawn Area" into workspace, place it where wanted, then change the properties up to where "TeamColor" is accurate to which is in the script.

Ad

Answer this question