I am trying to make a simple shark that chases players and slowely speeds up. The best method I thought of is having AlignPosition set to the target player and slowely increase the MaxVelocity. The speeding up part of the shark works fine but I noticed that the shark stays with the target character no matter what even if the MaxVelocity is zero as you can see in the video. I thought it was an issue with them both having the same parent since it would make sense in this context but even after I parented the shark mesh to the workspace it still has the same behaviour. I also double checked the attachment position in the workspace and it is correctly in the NPC.
if conditionsToStartSharkChase then
self._isSharkRoaming = false
self._targetPlayer = closestPlayer
self._a1 = Instance.new("Attachment")
self._a1.Parent = self._swimmersFolder[self._targetPlayer.Character:GetAttribute("SwimmerId")].HumanoidRootPart
self._shark.AlignPosition.Attachment1 = self._a1
local part = Instance.new("Part")
part.Transparency = 1
part.Size = Vector3.new(1, 1, 1)
part.Position = self._postModel.SwimmerSpawnBoundry.Position
part.CanCollide = false
part.Parent = self._postModel
self._a1OrientionPart = part
self._a1Orientation = Instance.new("Attachment")
self._a1Orientation.Parent = part
self._shark.AlignOrientation.Attachment1 = self._a1Orientation
self._shark.Anchored = false
if tween ~= nil then
tween:Cancel()
end
if movementTween ~= nil then
movementTween:Cancel()
end
self._shark.AlignPosition.MaxVelocity = 0
self._shark.AlignOrientation.MaxTorque = 10
task.spawn(function()
while true do
task.wait(100)
if self._targetPlayer ~= nil then
self._shark.AlignPosition.MaxVelocity += 0.25
self._shark.AlignOrientation.MaxTorque += 5
end
end
end)
end
VIDEO EXAMPLE: