How to make a flying zombie swoop down and chase you?

How do I make a flying zombie chase you and swoop down towards you? I’ve already gotten the magnitude script done and I’ve tried using body position and body velocity but I’m not an expert on those.

2 Likes

Perhaps you can show us your script.

Sorry it took so long, I had to do stuff
here is the script:

local Root = script.Parent.HumanoidRootPart
game.Players.PlayerAdded:Connect(function(player)
local char = player.CharacterAdded:Wait()
local Part = char:FindFirstChild("HumanoidRootPart")	
local checkRange = 15	

while true do
	if (Root.Position - Part.Position).Magnitude < checkRange then
		print("close")
		Root.Parent.Humanoid:WalkToPart(Part.Position)
		Root.BodyPosition.Position = Part.Position
	else
		print("not close")
	end
	wait()
end
end)

there is a body position in the humanoid root part
D = 1250
MaxForce = 4000, 15000, 4000
P = 10000
Position = 12.044, 7.658, 492.403

Ok. thanks. When a player is added what does the script print out?

it prints not close when the player joins

So it looks like it only does the one cycle.
Was that the intention?
Or
Was you looking for it to happen any time through the game.
If that is so then move the parts that makes it only run at player add.

i added a while true do so it will keep running forever until it dies
everything works except the part where the zombie flies

I don’t know if this helps

root = (The character to follow) :FindFirstChild("HumanoidRootPart")

script.Parent.Humanoid:MoveTo(root.Position)

The height is determined by the distance from the target. It rises if it is far and decreases if it is close

If the target is far away

bodyPosition.Position = (Put the height you want)

If the target is close

root = (The character to follow) :FindFirstChild("HumanoidRootPart")

bodyPosition.Position = root.Position

You should use the follow code, it is everywhere you can get it easily and rewrite the code correctly, do not copy and paste it, it will not help you with anything

I apologize for my writing mistakes. I don’t speak English

1 Like

Do you know what MaxForce, P, and D does? I’m kinda confused about BodyPositions and BodyVelocities; Basically anything with body in it

I’m sorry, the translation is not clear. Try writing separate sentences, the translation will be better

You are only using BodyPosition

The movement relied on Humanoid:MoveTo()

It will work fine

If it doesn’t work well, post the problem here and we’ll get to the solution in the end

And if you used another method, then there is no problem, the important thing is that it does what you want