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

How to teleport to a private server in a place? (Like Tower Defense Simulator's teleport system)

Asked by 4 years ago

I have a question to ask, I'm working a Tower Defense game on Roblox, and I've made a simple teleport script (as shown below). It's a place not a game that you teleport to. When you teleport it works but a player can join while mid-game, which I don't want. I want it like or similar to the teleportation system in Tower Defense Simulator and other games that use a similar way/style. I would love it if someone helped me! <3

~ notreallysupernova

01local MapCollection = 5770100191
02local MapID = MapCollection
03 
04function onTouched(hit)
05      local player = game.Players:GetPlayerFromCharacter(hit.Parent)
06      game:GetService("TeleportService"):Teleport(MapID, player)
07  end
08 
09 
10script.Parent.Touched:connect(onTouched)
11 
12print("Teleported to ".. MapID)

Answer this question