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

when they teleport they land on top of each other. how do i offset it?

Asked by 6 years ago
Edited 6 years ago
wait(2) --teleport
function teleAll(x, y, z)
    local pos = Vector3.new(x, y, z)
    for _, plr in pairs(game:GetService("Players"):GetPlayers()) do
        if plr.Character then
            plr.Character:MoveTo(pos)
        end
    end
end

teleAll(0, 2, 0)

how do I add an offset so they spawn in random positions around the board information that may or may not be useful the script is in serverscript position of board -19.172, 83.968, -5.537 the board is a union

0
Roblox SpawnLocation's spread players out over the size of the SpawnLocation when they spawn in now. The easiest fix would be to put a SpawnLocation where you want people to teleport to and scale it's x and z axis out until it's big enough to comfortably fit all of your players. Then in your teleport function, set the players RespawnLocation and call LoadCharacter. Would this work for you? vector3_zero 1056 — 6y
0
yeah it would how do you do that EpicAshtonTheBoy 33 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Place a SpawnLocation where you want the players to be appearing. Scale it up so that there is plenty of room for the players to all spawn in without appearing on top of each other. You can set the SpawnLocation to transparent if you like. You also need it to be set to neutral or to the players team color. Then you can just use the script you have, but change it slightly to set the players RespawnLocation and call LoadCharacter.

wait(2) --teleport
function teleAll()
    for _, plr in pairs(game:GetService("Players"):GetPlayers()) do
        plr.RespawnLocation = workspace.YourSpawn
        plr:LoadCharacter()
    end
end

teleAll()

Change workspace.YourSpawn to the name of the SpawnLocation that you created. Just be aware that the players will keep spawning in that location if they die unless you set another spawn location for them.

0
it says Error bad cast EpicAshtonTheBoy 33 — 6y
0
for teleAll() EpicAshtonTheBoy 33 — 6y
0
You will get that error if workspace.YourSpawn isn't a SpawnLocation. Double check that you are setting it to the SpawnLocation that you added vector3_zero 1056 — 6y
Ad

Answer this question