This is my code:
local maths = 10
local limb = "Head"
wait(5)
repeat
local p1 = script.Parent.nearest.Value
if p1 ~= "nil" then
local player = game.Workspace[p1]
local pos = script.Parent.Position
local ppos = player[limb].Position
-- X
local x1 = pos.X - ppos.X
local x2 = x1 / 10
-- Y
local y1 = pos.Y - ppos.Y
local y2 = y1 / 10
-- Z
local z1 = pos.Z - ppos.Z
local z2 = z1 / 10
-- hunt down the player
script.Parent.energy.Value = script.Parent.energy.Value - 1
script.Parent.Position = script.Parent.Position - Vector3.new(x2,y2,z2)
end
wait(0.01)
until nil
The problem here is, no error, is that it makes the brick move to the player, but since it divides the distance by 10 it will get slower as it gets closer to the player, and faster as the player moves away, making an infinite stalemate if the player walks away. I was wondering if a fixed speed was possible.
Is there a CFrame property I'm missing?

1 comment
Yeah body postion is the way to go, it has MaxVelocity property.