In my game there is a boss fight, and everything works well except when after the boss charges towards the player. The boss gets a high WalkSpeed then runs toward player. Humanoid:MoveToFinished:Wait() waits the max 8 seconds cutoff for Humanoid:MoveTo() instead of the amount of time the boss takes to get to the player, even though the boss clearly makes it and stops moving.
Entire script:
local dizz = script.Parent.Humanoid:LoadAnimation(script.Dizzy)
local charge = script.Parent.Humanoid:LoadAnimation(script.Charge)
dizz.Looped = true
charge.Looped = true
function dizzy()
script.Parent.Dizzy.Value = true
dizz:Play()
wait(3)
dizz:Stop()
script.Parent.Dizzy.Value = false
end
while wait(math.random(10,11)) do
charge:Play()
script.Parent.Humanoid.WalkSpeed = 0
script.Parent.AI.Disabled = true
script.Parent.AI.DamageTaken.Value = 80
local plr = workspace:FindFirstChild(script.Parent.AI.Tracking.Value)
local direction = (script.Parent.HumanoidRootPart.Position - plr.HumanoidRootPart.Position).Unit * 2
wait(2)
charge:Stop()
script.Parent.Humanoid.WalkSpeed = 55
script.Parent.Humanoid:MoveTo(plr.Torso.Position + direction)
script.Parent.Humanoid.MoveToFinished:Wait()
script.Parent.Humanoid.WalkSpeed = 15.9
script.Parent.AI.DamageTaken.Value = 20
dizzy()
wait(1)
script.Parent.AI.Disabled = false
end
Any help would be appreciated! This isn’t a super professional game so I’m not really using variables