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

How do you use the :MoveTo() command?

Hello I have made questions about this in the past, but none of the answers seemed to help. as when I load in the game and the script is supposed to activate it doesn't work?

Here is the script i made but it doesn't move the character when they join at all. Please help

function onPlayerEntered(newPlayer)
	wait(0.5)
	do game.Players.PlayerName.Character:MoveTo(Vector3.new(0.06, 1, -454.194))
	end
end

2 answers

It's easier to just change the character's cframe, MoveTo is for models.

game.Players.PlayerName.Character.PrimaryPart.CFrame = CFrame.new(position)

As I see, you want to use a :MoveTo() command. You didn't tell us, do you get anything highlighted in red or orange. When you are teleporting a player, it's easier to use :SetPrimaryPartCFrame(), but you need to have defined PrimaryPart in your Model. As I see, you want to teleport a player, so Player already has defined PrimaryPart, so it's easy to teleport it! Here's the code that will help you:

Make sure to put this code in a LocalScript inside of a ScreenGui, you can name it however you want!

local Player = game:GetService("Players").LocalPlayer

game.Players.PlayerAdded:Connect(function()

	local char = Player:WaitForChild("Character")

	char:SetPrimaryPartCFrame(CFrame.new(0.06, 1, -454.194))
	
	--[[If you need to rotate the model, just replace line 7 with: char:SetPrimaryPartCFrame(CFrame.new(0.06, 1, -454.194) * CFrame.Angles(0, 0, 0))
Those three zeros on the end are orientation for the model!
]]
end)

Hope I helped you this time! ^_^

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