Hey i got to workin, avoided the usage of Tweens or AlignPosition and decided to use this for my client movement.
I enhanced your code and instead of using it to move i used it to set the position it should go to.
enemy.Position = calc -- Vector3.new(v2int16.X / 50, enemy.Model.PrimaryPart.Position.Y, v2int16.Y / 50)
enemy.Moved = 0 -- this will be how my code will movement work.
and I used a heartbeat to create the effect that the enemy is moving by using lerping and pivot to…
runservice.Heartbeat:Connect(function(dt)
for i,v in ipairs(enemies) do
local model = v.Model
v.Moved += dt * v.Speed
if not v.Position then v.Moved = 0 continue end -- this is just an unnecessary checkk that i still want to keep.
local position = v.Position
local lerp = model.PrimaryPart.Position:Lerp(position, v.Moved)
model:PivotTo(CFrame.new(lerp))
end
end)
and this is what I got. https://gyazo.com/15544e55e1150f0ead28c364de827945.mp4
It “boosted” the movement at the start but it’s constant after that so essentially its just for vanity.
I used AlignPosition and it lagged by 300 enemies, I can’t get tweens to work so I gave up, this is imo the optimal way I could do client movement.
for rotation? currently working on it.