I want the player to teleport to another place without changing server, so when he return to main place he will find the same players, I found a teleport script but when the player teleport to a place it changes the server so when he return back he returns to a diffiternt server and not to the server that he was in. Can anyone help? This is the scrip I found :

local TeleportService = game:GetService("TeleportService")
 
local placeID_1 = 408502340
 
local function onPartTouch(otherPart)
	local player = game.Players:GetPlayerFromCharacter(otherPart.Parent)
	if player then
		TeleportService:Teleport(placeID_1, player)
	end
end
script.Parent.Touched:Connect(onPartTouch)

2 comments

0

You need to use TeleportToPlaceInstance to go to a specific lobby server by ID, and this means the satellite place has to know what lobby the player came from, which can be done with teleport data (easiest and preferred), datastores, messageservice, or your own server solution. See the example here: https://developer.roblox.com/en-us/api-reference/function/TeleportService/TeleportToPlaceInstance

0

how can I use it in my code ?