How do I make a part that the player can swim in?

If you have heard of Robot 64, you can swim in a part that is just water, how can I do the same thing?

Instead of creating a part, you can use the terrain editor to generator realistic water and swimming animations


Thats what I don’t wanna do.

I don’t like using that terrain system, especially with my type of game.

I want to make a part that I can make into water.

Here is a script I found to do this:

local Sea = workspace.Sea --Directory of the water part
local RS = game:GetService("RunService")
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local Root = Character:WaitForChild("HumanoidRootPart")
local Swim

	if Root.Position.Y < Sea.Position.Y - Root.Size.Y / 2 then
		if not Swim then
			Swim ="BodyVelocity")
			Swim.Parent = Root
		Swim.Velocity = Humanoid.MoveDirection * Humanoid.WalkSpeed +,4,0)
		if Humanoid:GetState() ~= Enum.HumanoidStateType.Swimming then
			Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
	elseif Swim and Root.Position.Y < Sea.Position.Y then
		Swim.Velocity = Humanoid.MoveDirection * Humanoid.WalkSpeed
	elseif Swim then
		Swim = nil
		Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, true)

This isn’t very helpful, because Im not sure how this script even works, and I don’t know where you got it from, Is there like a function or something that I can use to make a part emulate the already made Roblox Water?

This is the original post, which explains it: