Humanoid:MoveTo() Moving to the incorrect position

So in a game I’m making there’s a boss called the Party Pooper and he has a special charge attack that’s him basically running into the player at a fast speed. I’m trying to achieve this by using Humanoid:MoveTo() and it does make the boss move however he doesn’t move to the correct position. Instead, he will move to the left or right of the player. I think this may be due to orientation though I’m not sure.

Code:


while wait(math.random(10,11)) do -- doesn't actually happen that often, just for debugging
	script.Parent.Humanoid.WalkSpeed = 0
	script.Parent.AI.Disabled = true
	script.Parent.AI.DamageTaken.Value = 60
	local plr = workspace:FindFirstChild(script.Parent.AI.Tracking.Value)
	wait(2)
	script.Parent.Humanoid.WalkSpeed = 55
	script.Parent.Humanoid:MoveTo(plr.Torso.Position + Vector3.new(0, 5, -15))
	script.Parent.Humanoid.MoveToFinished:Connect(function()
		script.Parent.Humanoid.WalkSpeed = 16
		script.Parent.AI.DamageTaken.Value = 20
	end)
	wait(1)
	script.Parent.AI.Disabled = false
end

Here is some footage:
robloxapp-20220621-1840348.wmv (1.9 MB)
Thanks!

How about just having it move to plr.Torso.Position without adding the additional vector movement?

2 Likes

Because usually even though it’s to the torso and not in front of the torso, he’ll just sprint in front of the player and do no damage

Also, I haven’t programmed it in yet, but he’s supposed to go all dizzy after and then you can hit em’

Huh, guess the wait bug was from an earlier version of the script, although I don’t like going directly to torso it’s what works best so it’s the solution.

1 Like

Unrelated but you should declare a reference for whatever ‘script.Parent’ represents, that way you can use it instead of ‘script.Parent’ constantly.

local parent = script.Parent --something like this