Ad
Log in to vote
0

Teleporting people to other maps, how?

Asked by 9 days ago

I am really bad at scripting. In my game I made a map changer. I need something to add on to it so after the map disappears all players will get teleported to a block on the other map, then after the map changes again they will teleport to another block in the other map. I have tried many methods but as I said I am not good at scripting. This is my current map code, if you have the time please help.

map1 = game.Workspace:findFirstChild("Ruins")
map2 = game.Workspace:findFirstChild("City")
time = 210
clone = map1:clone()
clone2 = map2:clone() 
wait()
map1:remove()
map2:remove()
while true do 
local map = clone:clone()
map.Parent = game.Workspace
wait(time)
map:remove()
local map = clone2:clone()
map.Parent = game.Workspace
wait(time)
map:remove()
end 

2 answers

Log in to vote
0
Answered by
ghxstlvty 133
9 days ago

You can teleport other players by getting a CFrame position value. To get one of these values, place down a block where you want the players to spawn, get the blocks position (x,y,z) and copy it and replace the position in this script below.

game.Players.LocalPlayer.Character:SetPrimaryPartCFrame(CFrame.new(Vector3.new(-330.02, -261.12, 1153.7)))

If you insert that into a function and add a few other things it will work!

Ad
Log in to vote
0
Answered by
MattVSNNL 116
9 days ago

Try doing this

for i, players in pairs(game.Players:GetPlayers()) do
    players.Character.HumanoidRootPart.CFrame = Vector3.new(-- The location of where the players need to go!)
end

Answer this question