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

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

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

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 comment

1

Did you even read my question?

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