-
I want to make a move system for the enemies. In this case, the enemies in my game is called “Blocks”. Since they are parts, I thought that I can use
TweenService
to make the move system for them. -
This the code I wrote:
local Waypoints = map:FindFirstChild("Waypoints")
local BlockStats = block:FindFirstChild("Stats")
local Speed = BlockStats.Speed.Value
for waypoint = 1, #Waypoints:GetChildren() do
local MoveAnimation = TweenService:Create(block, TweenInfo.new(Speed, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), {Position = Waypoints[waypoint].Position})
MoveAnimation:Play()
MoveAnimation.Completed:Wait()
end
end
The issue is, when the part is longer, it moves faster; when the part is shorter, it moves slower.
So, how can I fix this problem. Or, is TweenService is even a good idea to use?
Thank you