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

How do you get motor6d to follow a player or an AI?

I want it to follow the target... just like bodygyro be rotating when it follows a part

charTorso.C1 = tTorso.C1 * CFrame.new(Vector3.new(0, 0, 0), charTorso.C1.lookVector) * CFrame.Angles(tTorso.C1.y, 0, 0);

3 comments

0

Please read this to write better questions: https://scriptinghelpers.org/help/how-post-good-questions-answers

0

Do you want a part / block to always be following a player? If so, let me know and i'll post a response.

0

yeah but using C1

1 answer

✓ Accepted answer

Motor6D is generally used for Animations with Humanoid, so that won't quite be useful to make a Part follow another.

The smoothest way to make a part follow another is to Weld them instead

game.Players.PlayerAdded:Connect(function(player)
	local character = workspace:WaitForChild(player.Name)
	local root = character:WaitForChild("HumanoidRootPart")
	local part = workspace.Part

	local weld = Instance.new("Weld")
	weld.Name = "Weld"
	weld.Parent = part
	weld.Part0 = part
	weld.Part1 = root
	weld.C0 = CFrame.new(0, 0, 5)
end)

The C0 Property determines the Offset from the welded parts The "part" that is welded to the player must be unanchored

The above example defines the action when the player is added, but this isn't the only function you can use.

1 comment

0

thats good but i'm talking about following a part like the humanoidrootpart of another player

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