Help With Custom Swim System (Telling if Player is Looking Up OR Down)?

Hey All,
I have a very simple code for a custom swim system (for a custom character). What it does is sets a BodyForce on the character, which goes toward the LookVector of the player’s camera (the player is in first person). This system is designed to work on Roblox Terrain Water, and it does work as intended. However, I was wondering, how do I let the player dive into the water (when looking down), and rise (when looking up). Right now, it just floats on top of the water, and moves forward, left, and right, even when looking straight down. My code (local script inside the character):

local Camera = workspace.CurrentCamera
while wait() do
	local Direction = Vector3.new(Camera.CFrame.LookVector.X,0,Camera.CFrame.LookVector.Z)*10000
	--game.Players.LocalPlayer:Move(Vector3.new(0, 0, -1), true)
	if not game.Players.LocalPlayer.Character.HumanoidRootPart:FindFirstChild("Forward") then


		local bodyForce = Instance.new("BodyForce")
		bodyForce.Name = "Forward"
		bodyForce.Parent = game.Players.LocalPlayer.Character.HumanoidRootPart
		game.Players.LocalPlayer.Character.HumanoidRootPart:FindFirstChild("Forward").Force = Direction
	else
		game.Players.LocalPlayer.Character.HumanoidRootPart:FindFirstChild("Forward").Force = Direction
	end
end

To repeat my question - how would I modify this code, so the player can dive down into the water, rise, AND go left and right? I am an intermediate-level scripter, but I am seriously stuck on this one. Thank you!

Edit
How do I tell if the player is looking up or down, and apply a bodyforce depending on whether it is up or down? I have this code so far

function UpOrDown(LookVector)
		local LookVector = LookVector.Unit
		local UpVector = Vector3.new(0, 1, 0)

		--Should return a value within range [-1, 1]
		return LookVector:Dot(UpVector)
	end

But how would I use the results (in an if statement)? Thanks!

I’ve remembered a topic discussing about this its about just setting the humanoid state type via

Humanoid:SetStateType(Enum.HumanoidStateType.Swimming, true) -- if true doesn't need to be there remove it

Thanks, but I’ve already tried this :frowning: The character is Platform Standing (so it can’t swim, because that flips the custom character into the air). Disabling swimming makes it so the character doesn’t interact with water at all. Any other suggestions?

Found a solve, super easy

local Camera = workspace.CurrentCamera
while wait() do
	local Direction = Vector3.new(Camera.CFrame.LookVector.X,Camera.CFrame.LookVector.Y,Camera.CFrame.LookVector.Z)*10000
	--game.Players.LocalPlayer:Move(Vector3.new(0, 0, -1), true)
	if not game.Players.LocalPlayer.Character.HumanoidRootPart:FindFirstChild("Forward") then


		local bodyForce = Instance.new("BodyForce")
		bodyForce.Name = "Forward"
		bodyForce.Parent = game.Players.LocalPlayer.Character.HumanoidRootPart
		game.Players.LocalPlayer.Character.HumanoidRootPart:FindFirstChild("Forward").Force = Direction
	else
		game.Players.LocalPlayer.Character.HumanoidRootPart:FindFirstChild("Forward").Force = Direction
	end
end

Didn’t take into account the Y axis, stupid mistake. Hope this helps future people