Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a block move to a player at a fixed speed? [SOLVED]

Asked by 5 years ago
Edited by DeceptiveCaster 5 years ago

This is my code:

01local maths = 10
02local limb = "Head"
03wait(5)
04repeat
05    local p1 = script.Parent.nearest.Value
06    if p1 ~= "nil" then
07        local player = game.Workspace[p1]
08        local pos = script.Parent.Position
09        local ppos = player[limb].Position
10        -- X
11        local x1 = pos.X - ppos.X
12        local x2 = x1 / 10
13        -- Y
14        local y1 = pos.Y - ppos.Y
15        local y2 = y1 / 10
View all 26 lines...

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 answer

Log in to vote
0
Answered by 5 years ago

Fixed, I'm gonna use bodyposition.

0
Yeah body postion is the way to go, it has MaxVelocity property. sleazel 1287 — 5y
Ad

Answer this question