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

How to get players to teleport to a team?

Asked by 10 years ago
if game.Workspace.Bool.Value == true then
    maps = game.ServerStorage.Maps:GetChildren()
    map = maps[math.random(1, #maps)]
    map:Clone().Parent = game.Workspace
    blue = 0
    red = 0
    local teamplay = game.Players.GetChildren()
    for i = 1,game.Players.NumPlayers do
        local ran = math.random(1,game.Players.NumPlayers)
        if blue == red then -- if they are the same it is randomely generated
            br = math.random(1,2)
            if br == 1 then
                teamplay[ran].TeamColor = BrickColor.new("Bright blue")
            elseif br == 2 then
                teamplay[ran].TeamColor = BrickColor.new("Bright red")
            end
        elseif red >= blue then
            teamplay[ran].TeamColor = BrickColor.new("Bright red")
        elseif blue >= red then
            teamplay[ran].TeamColor = BrickColor.new("Bright blue")
        end
    end
    for _,player in pairs(game.Players:GetPlayers()) do
        if player.Character then
               spawns = map.Spawns:GetChildren()
         player.Character:MoveTo(spawns[math.random(1, #spawns)].Position)
       end
    end
    wait(300)
    for i,player in pairs(game.Players:GetPlayers()) do
        if player.Character then
            player.Character.Head:remove()
            player.TeamColor = BrickColor.new("White")
        end
    end
end

heres a script that this guy gave me, and i have edited it, and the map loads, but the players dont tp to spawns. Does anyone know where the spawns have to be placed? Inside each seperate map, or inside workspace already? And what are the spawns suppose to be called??

1 answer

Log in to vote
0
Answered by
hiccup111 231 Moderation Voter
10 years ago

As long as the teams are allocated, and the SpawnPositions are in the game (atleast in workspace), you can just re-spawn the characters.

Quick Respawn Method : (Server Script only)


player = game.Players.Player1 player :LoadCharacter()

--http://wiki.roblox.com/index.php?title=LoadCharacter_(Method)--

0
I have teams in the teams service and the right colours, but where do i put the spawns or blocks for each map NinjoOnline 1146 — 10y
0
They can go anywhere in Workspace, or with in a map, aslong as they're a member of Workspace e.g. "Workspace.Map.SpawnLocation", put ROBLOX characters already spawn to their designated team spawns. Do more resarch of the Roblox WIKI. hiccup111 231 — 10y
0
So the spawns are called SpawnLocations?? NinjoOnline 1146 — 10y
Ad

Answer this question