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

How do I make this part of the script do this?

What I want this script to do is to teleport a player to a certain part of my world. The only problem is is that I don't know how to make sure that the script doesn't only teleport a certain player (Player1) but all people who join the game. For example, when TheGamer101 joins the game, I want TheGamer101 to be teleported. But at the same time, when I join the game, I want to be teleported to the same destination. How do I do that with a script?

Here's the script.

game.Workspace.Player1.Torso.CFrame = CFrame.new(Vector3.new(-4384.4, -397.303, 3167.8))

2 answers

✓ Accepted answer
game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		character.Torso:MoveTo(Vector3.new(-4384.4, -397.303, 3167.8))
	end)
end)

Since this was so simple I decided to give you the script. Use MoveTo next time however as it's easier

Here you go good sir, fresh from the land of notepad.

Special_people = {"LOLOLOLOLMRocks37Alt", "TheGamer101"}

function Teleport(plr, target)
	wait()
	plr.Character.Torso.CFrame = target
end

Game.Players.PlayerAdded:connect(function(plr)
	plr.CharacterAdded:connect(function(char)
		for a,c in pairs(Special_people) do
			if plr.Name == c then
				Teleport(plr, CFrame.new(-4384.4, -397.303, 3167.8))
			end
		end
	end)
end)

2 comments

0

There is a better way to do this. He also want's ALL players to teleport

0

No I'm pretty sure he wanted CERTAIN players to teleport.

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