Can there please be an option to turn this off? Because every time I make an NPC, I have to get through this barrier. And I hate it. It ruins my game with twitchy NPCs.
I have tried using animations that play when the NPC is in water, but the animation twitches because the animation either doesn’t stop in time or doesn’t start in time.
I have tried using body gyros that work well enough but then with enemy NPCs, I’m having trouble. How can I make it move to the position of the closest HumanoidRootPart instead of just move to the HumanoidRootPart?
Here’s the script:
function findNearestTorso(pos)
local list = game.Workspace:children()
local torso = nil
local dist = 100
local temp = nil
local human = nil
local temp2 = nil
for x = 1, #list do
temp2 = list[x]
if (temp2.className == "Model") and (temp2 ~= script.Parent) then
temp = temp2:findFirstChild("HumanoidRootPart")
human = temp2:findFirstChild("Humanoid")
if (temp ~= nil) and (human ~= nil) and (human.Health > 0) and (human.Parent.Name ~= script.Parent.Name) then
if (temp.Position - pos).magnitude < dist then
torso = temp
dist = (temp.Position - pos).magnitude
end
end
end
end
return torso
end
while true do
wait(0.001)
local target = findNearestTorso(script.Parent.HumanoidRootPart.Position)
if target ~= nil then
script.Parent.Humanoid:MoveTo(target.Position, target)
end
end
Another option would be to build an aquatic npc vertically, but how would I make it move nonstop?