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

How do i make a script that sends the player to another 'Place' in the game?

I have no idea, I really need help with this. theres not really any details i can give. Oh, And when i say 'Place' i dont mean like a teleport script, i mean a script that takes you to like a place, like one of the game's places, thanks

2 answers

In game explorer, right click places. then click add new place and then name it whatever. When youre done, right click the new place and click copy id.

https://dk135eecbplh9.cloudfront.net/assets/blt57b648cb6053c4db/TeleportService-Copy-ID-to-Clipboard.png

This is the script where whenever the part is touched, you will get teleported there.

local TeleportService = game:GetService("TeleportService")
 
local placeID_1 = 408502340 --add the copied id here
local placeID_2 = 408502380 --[[ i dont know what this does i got this in notepad i dont remember where i got it. ]]--
 
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)

and then this is the script where you can get teleported to the place where your friend is.

local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
 
Players.PlayerAdded:Connect(function(player)
	-- Is this player following anyone?
	local followId = player.FollowUserId
	-- If so, find out where they are
	if followId and followId ~= 0 then
		local success, errorMessage = pcall(function()
			-- followId is the user ID of the player that you want to retrieve the place and job ID for
			currentInstance, _, placeId, jobId = TeleportService:GetPlayerPlaceInstanceAsync(followId)
		end)
		if success then
			-- Teleport player
			TeleportService:TeleportToPlaceInstance(placeId, jobId, player)
		end
	else
		warn("Player " .. player.UserId .. " is not following another player!")
	end

I made one under a player added event. Here is the code:

local PlaceID = 12345

game:GetService("Players").PlayerAdded:Connect(function(User)
	repeat wait() until User ~= nil
	game:GetService("TeleportService"):Teleport(PlaceID, User)
end)

I'm sure that should do the trick. Send a comment informing me if it works or not.

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