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

Teleporting players to specific spawn points, while restricting normal spawns there?

Asked by 7 years ago

Here's what I have: I have a multi-place game that teleports players to and from other places. I can force a player to spawn at a certain spawn point.

Right now I have three spawns in a level: Neutral, Red, and Blue. In another game place, I have a spawn and Red/Blue teleporters that transport players back to the first game. However, since the spawns must be "Neutral" in order to force a spawn location, any player can spawn at those.

How do I make sure that only players that come from the second game can spawn there? Can it be done with storing data on the Roblox server as to which color was chosen, and reloading it on the other place?

This is my current teleport script for the red teleporter in the second place:

local TeleportService = game:GetService("TeleportService")
local level1Id = ######### --game id

local level1SpawnName = "Finished1RedSpawn"

function onTouched(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if player then TeleportService:TeleportToSpawnByName(level1Id , level1SpawnName, player)
    end
end

script.Parent.Touched:connect(onTouched)

1 answer

Log in to vote
0
Answered by 7 years ago
local player = game.Players:GetPlayers()
for i = 1, #player do
player[i].Character:MoveTo(Vector3.new(0,2,0))
end

it will teleport anyplayer to that one spot

1
Did you even read my question? DarkSideKyp 50 — 7y
Ad

Answer this question