How to make a Part following a Part?

‘sry for bad english’

Hello everyone!

Im working on a game where the Player controls a Part

I wanted to add some enemys which follow the Part

I first thought about Model:MoveTo() but its not what I want

Are there other ways to do that?

Here is a picture how the Parts look like:

ThisIsMyIDKWhatlol

I fixed it myself:

local Control = game.Workspace.Control
local Me = script.Parent
while true do
	wait()
	local magnitude = (Me.Position - Control.Position).Magnitude
	
	if magnitude <50 then
		if Control.Position.X < Me.Position.X then
			Me.Position = Me.Position - Vector3.new(0.4,0,0)
		end
		if Control.Position.X > Me.Position.X then
			Me.Position = Me.Position + Vector3.new(0.4,0,0)
		end
	else
		
	end
end

Hey, I recommend using AlignPosition instead. It will yield a result a lot smoother than a while true loop for updating the position.

1 Like

Ok , thank you for your help :smiley:

1 Like