How to make a block move to a player at a fixed speed? [SOLVED]
This is my code:
05 | local p 1 = script.Parent.nearest.Value |
07 | local player = game.Workspace [ p 1 ] |
08 | local pos = script.Parent.Position |
09 | local ppos = player [ limb ] .Position |
11 | local x 1 = pos.X - ppos.X |
14 | local y 1 = pos.Y - ppos.Y |
17 | local z 1 = pos.Z - ppos.Z |
21 | script.Parent.energy.Value = script.Parent.energy.Value - 1 |
22 | script.Parent.Position = script.Parent.Position - Vector 3. new(x 2 ,y 2 ,z 2 ) |
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?