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

Teleport to random location?

Hi,

I am trying to create a roleplaying game and I want to have the player to spawn on a random team pad but I am having trouble creating the script.

Any help would be appreciated.

Thanks.

local ParentPad = workspace.Spawns.Parent local KidPad = workspace.Spawns.Child local TeenPad = workspace.Spawns.Teenager local PetPad = workspace.Spawns.Pet

game.Players.PlayerAdded:connect(function(player) local TeamNumber = math.random(1,5)

if(TeamNumber == 1)
	then
 
end
	if(TeamNumber == 2)
	then
	player:MoveTo(ParentPad.Position)
	end
		if(TeamNumber == 3)
	then
	player:MoveTo(ParentPad.Position)
		end
			if(TeamNumber == 4)
	then
	player:MoveTo(ParentPad.Position)
end

end)

2 comments

0

what is "TeenPad" for in line two?

0

Put the WHOLE script in the code block and I can help you

1 answer

Hello,

The pads are the spawn locations.

Here is the full code:

 local ParentPad = workspace.Spawns.Parent
local KidPad = workspace.Spawns.Child
local TeenPad = workspace.Spawns.Teenager
local PetPad = workspace.Spawns.Pet

game.Players.PlayerAdded:connect(function(player)
	local TeamNumber = math.random(1,5)
	
	if(TeamNumber == 1)
		then
	 
	end
		if(TeamNumber == 2)
		then
		player:MoveTo(ParentPad.Position)
		end
			if(TeamNumber == 3)
		then
		player:MoveTo(ParentPad.Position)
			end
				if(TeamNumber == 4)
		then
		player:MoveTo(ParentPad.Position)
	end
end)

Thanks.

1 comment

0

This don't willwork

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