Making a humanoid move underwater

I want my whale humanoid to move straight forward from its starting point underwater.
The issue is when I use the MoveTo() function to achieve this, the whale acts weird (as you can see in the video) and doesn’t reach the location I wanted it to.

I’ve read that it’s natural for a humanoid to flip like that when in water, but I want to know if there is any way I can just make it move straight forward? I know that CFraming its movements would be glitchy, and I don’t know of any other way to move it except for maybe using body velocity or something like that. I tried to add an animation so that the torso wouldn’t flip but it doesn’t go forward.

My whale model is a custom humanoid and rigged. I changed its body density in my script so that it doesn’t float or sink. After the whale’s rotation goes back to normal, it prints “Whale stopped moving”. The red dot in the video shows the location where it is meant to swim to.

Here is my script, it’s placed underneath my whale model:

local whale = game.Workspace.Whale
local humanoid = whale.Humanoid

--Changing the whale's body density so that it won't float up.
for _, Part in pairs(whale:GetDescendants()) do
	if Part:IsA("BasePart") then
		print("Changing")
		Part.CustomPhysicalProperties = PhysicalProperties.new(.97, 0.3, 0.5) --density, friction, elasticity
	end
end

humanoid:MoveTo(Vector3.new(-492.59, 49.786, 2606.829))
humanoid.MoveToFinished:Wait(1)
print("Whale stopped moving")
2 Likes

Change this line;

humanoid.movetofinished:Connect(moveFinished())

To:

humanoid.MoveToFinished:Wait()

Thank you, I did. It’s still acting the same but the printing isn’t messing up now. It prints when the whale’s rotation goes back to normal. I also edited the post with the updated script and outputs :slight_smile:

I wouldn’t recommend using a humanoid for a large model like that, it would clump up your work and make it harder to do things while making it look nice

okay thanks. I made it a humanoid so I could animate it, is there a way to animate and rig the model without making it a humanoid? Also how would I be able to move it forward without using humanoid:MoveTo()?

Maybe you can use Tween for it?

Okay! I’ll try it. Will tweening be laggy?

I don’t think it will be laggy it will be smooth.

Tweening can sometimes take up a lot of memory but I think you should be good.

Okay thank you! I appreciate it :slight_smile:

I made a module a few months ago that allows you to tween parts easily. Not sure if your interested or not. EZ Pathfinding V2 [OUTDATED]

i suggest using tween or pathfindingservice. that will solve the moving problem + it will be more smoother.

you can read about them:
Pathfindinfservice: Character Pathfinding | Documentation - Roblox Creator Hub
Tween: Tween | Documentation - Roblox Creator Hub

1 Like

Thanks, I will check them out!

How did you use pathfinding? For me, when I try to use pathfinding, it sinks to the bottom, and doesn’t go to the player that is at the very surface of the water.