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

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

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

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.

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