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

If I use a single teleport pad, can I tp people to multiple other spots?

As I'm making a game, I need to make a teleport pad, but that teleport pad should teleport players to random spots within a certain area. I know how to tp a player from the tp pad to one single spot, but don't know how to randomize where they get teleported to if they touch the same block. My script looks like this;

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild('Humanoid')then
		hit.Parent.HumanoidRootPart.CFrame = CFrame.new(-1396.246, 21.25, 580.245)
	end
end)

So, anyone please explain how to tp people from one teleport pad to multiple other blocks

1 answer

Yes, have a table containing all the possible spots:

possibleLocations = {game.Workspace.Spot1, game.Workspace.Spot2} 

inside your for loop pick a random position by saying

pickedLocation = possibleLocations[math.random(1,#possibleLocations)]

then set the characters cframe to picked locations CFrame.

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