i want to make a roblox mall that would teleport you to other places when you walk into the store so if you walk in a store within the mall it teleports you to a place like kestral store like in the winter games lobby
Use the teleport service then. Example:
1 | ts = game:GetService( "TeleportService" ) |
2 | game.Workspace.Part.Touched:connect( function (hit) |
3 | if hit.Parent and hit.Parent.Humanoid then |
4 | ts:Teleport( 5837573 , game.Players:GetPlayerFromCharacter(hit.Parent)) --the number is the id of the place. |
5 | end |
6 | end ) |
To do this you need to use the TeleportService. Here's a script for it. Put this script into the PART that you want to teleport you to the place. Note: You need to change the PlaceId yourself.
01 | PlaceId = 000000 |
02 | Part = script.Parent |
03 | Players = Game:GetService( "Players" ) |
04 |
05 | Part.Touched:connect( function (Hit) |
06 | Player = Players:GetPlayerFromCharacter(Hit.Parent) |
07 | if Player then |
08 | Game:GetService( "TeleportService" ):Teleport(PlaceId, Player.Character) |
09 | end |
10 | end ) |
Well, if you add this script inside the part and change the PlaceId to the PlaceId of the game you want them to go to, it should work.
Example: To Use It Insert A Teleportal to a game/place
1 | ts = game:GetService( "TeleportService" ) |
2 | game.Workspace.Part.Touched:connect( function (hit) |
3 | if hit.Parent and hit.Parent.Humanoid then |
4 | ts:Teleport( 5837573 , game.Players:GetPlayerFromCharacter(hit.Parent)) --the number is the id of the place. |
5 | end |
6 | end ) |