Dragon NPC hitboxes break(?) when taking off!

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I’m making an enemy dragon NPC for an action adventure game.
    It has Hitboxes welded into each corresponding part of the body parts.
    It has fireball attacks and has a Part(FirePart) welded in its mouth to refer where the fireball should be fired from.
    It anchors the HumanoidRootPart and updates its position in a loop.

  2. What is the issue? Include screenshots / videos if possible!
    The hitboxes and the FirePart seem to always stop working or offset after the dragon takes flight.
    Link of videos for comparison:

Videos for comparison

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried swapping the dragon to a entirely new one with the previous HP after landing
    But didn’t work.
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- This is an example Lua code block

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Can someone tell me how can I fix these issues please??

By the way here are the parts I’m sure are causing the problems!

local function performTakeoff()
	movementState = "TakingOff"
	stopAllAnimations()
	TakeoffAnim:Play()
	animPlaying = true
	hrp.Anchored = true
	local startPos = hrp.Position
	local targetHeight = startPos.Y + CONFIG.FlightHeight
	local startTime = tick()
	local elapsedTime = 0
	while elapsedTime < CONFIG.TakeoffDuration do
		elapsedTime = tick() - startTime
		local alpha = elapsedTime / CONFIG.TakeoffDuration
		local newY = startPos.Y + (targetHeight - startPos.Y) * alpha
		hrp.Position = Vector3.new(startPos.X, newY, startPos.Z)
		task.wait()
	end
	stopAllAnimations()
	movementState = "Flying"
	FlyAnim:Play()
	animPlaying = true
end
local function performLanding(targetPosition)
	movementState = "Landing"
	LandingAnim:Play()
	animPlaying = true
	local startPos = hrp.Position
	local finalPosition = targetPosition or getNearestWaypoint(startPos).Position or startPos
	local groundY = getGroundHeight(finalPosition)
	local adjustedY = groundY + (hrp.Size.Y / 2) + CONFIG.HipHeight
	local targetPos = Vector3.new(finalPosition.X, adjustedY, finalPosition.Z)
	local directionXZ = (targetPos - startPos) * Vector3.new(1, 0, 1)
	local targetCFrame = directionXZ.Magnitude > 0.1 and CFrame.new(startPos, startPos + directionXZ) or hrp.CFrame
	local startTime = tick()
	local elapsedTime = 0
	while elapsedTime < CONFIG.LandingDuration do
		elapsedTime = tick() - startTime
		local alpha = elapsedTime / CONFIG.LandingDuration
		local newPos = startPos:Lerp(targetPos, alpha)
		hrp.Position = newPos
		local currentDirectionXZ = (targetPos - newPos) * Vector3.new(1, 0, 1)
		if currentDirectionXZ.Magnitude > 0.1 then
			hrp.CFrame = hrp.CFrame:Lerp(CFrame.new(newPos, newPos + currentDirectionXZ), 0.5)
		end
		task.wait()
	end
	hrp.Position = targetPos
	if directionXZ.Magnitude > 0.1 then
		hrp.CFrame = CFrame.new(targetPos, targetPos + directionXZ)
	end
	hrp.Anchored = false
	movementState = "Ground"
	humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
	humanoid.HipHeight = CONFIG.HipHeight
	stopAllAnimations()
	walkAnim:Play()
	animPlaying = true
	lastPos = nil
end
local function flyTo(destination)
	if movementState == "Ground" then
		performTakeoff()
	end
	local targetPosition = destination:IsA("BasePart") and destination.Position or destination
	local startPos = hrp.Position
	local targetPos = Vector3.new(targetPosition.X, startPos.Y, targetPosition.Z)
	local distance = (targetPos - startPos).Magnitude
	local travelTime = distance / CONFIG.FlightSpeed
	local startTime = tick()
	local elapsedTime = 0
	while elapsedTime < travelTime do
		local target = findTarget()
		if target and target.Humanoid.Health > 0 then
			performLanding(target.HumanoidRootPart.Position)
			lastPos = target.HumanoidRootPart.Position
			triggered = true
			return true
		end
		elapsedTime = tick() - startTime
		local alpha = elapsedTime / travelTime
		local newPos = startPos:Lerp(targetPos, alpha)
		hrp.Position = newPos
		local directionXZ = (targetPos - hrp.Position) * Vector3.new(1, 0, 1)
		if directionXZ.Magnitude > 1 then
			hrp.CFrame = hrp.CFrame:Lerp(CFrame.new(hrp.Position, hrp.Position + directionXZ), 0.5)
		end
		task.wait()
	end
	hrp.Position = targetPos
	return false
end

Use CFrame and not position or welds get disabled for that purpose.