How do you animate the character while its tweening without a humanoid?
Problems
what else can i use besides tweening since its not very consistent with the speed of the character
how do i plant or give the character gravity so they touch the ground
i figured out the animating part but i used animation controller:LoadAnimation()
but is that deprecated? If so what should i use instead?
local Test = game:GetService("ServerStorage").Enemies.Test:Clone()
Test.Parent = workspace.Enemies
Test:PivotTo(workspace.EnemySpawn.CFrame)
local animator = Test.AnimationController
local animTrack = animator:LoadAnimation(animator.Walk):Play()
coroutine.wrap(function()
for currentpoint = 1, #workspace.Pathpoints:GetChildren() do
local targetCFrame = workspace.Pathpoints[currentpoint].CFrame
local tweenInfo = TweenInfo.new(
3,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out
)
-- Create the tween
local tween = TweenService:Create(
Test.PrimaryPart,
tweenInfo,
{ CFrame = targetCFrame }
)
tween:Play()
tween.Completed:Wait()
end
end)()
task.wait(0.5)
Before the coroutine, add a local variable called previousWaypoint, and after the tween is completed inside the move function, set the previousWaypoint to that waypoint
Also, I recommend only using positions and then using the CFrame property :LookAt() to look at the waypoint, and if you choose to use CFrame:Lerp() then you can construct a CFrame from that
for i = 1, 3 do
local Test = game:GetService("ServerStorage").Enemies.Test:Clone()
Test.Parent = workspace.Enemies
Test:PivotTo(workspace.EnemySpawn.CFrame)
local previous_waypoint = workspace.EnemySpawn
coroutine.wrap(function()
for currentpoint = 1, #workspace.Pathpoints:GetChildren() do
local distnace = (previous_waypoint.Position - workspace.Pathpoints[currentpoint].Position).Magnitude -- distance calculation
local speed = Test:GetAttribute("Speed") -- enemy speed
local TravelTime = distnace/speed
local info = TweenInfo.new(
TravelTime,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out
)
local tween = TweenService:Create(
Test.PrimaryPart,
info,
{CFrame = workspace.Pathpoints[currentpoint].CFrame}
)
tween:Play()
tween.Completed:Wait()
local rot = CFrame.lookAt(previous_waypoint.Position, workspace.Pathpoints[currentpoint].Position)
Test.PrimaryPart.CFrame = Test.PrimaryPart.CFrame * rot
previous_waypoint = workspace.Pathpoints[currentpoint]
end
Test:Destroy()
end)()
task.wait(0.5)
end
when they reach the waypoint they teleport away far away and then walk to the next one
Its something with the lookAt function, quote it out and see if it atleast moves to the positions (actually with these modifications you can just entirely remove the lookAt function)