How do I make player float on uncancollided part? (Custom Swimming)

how it will look like floating on the uncancollided part: (reference)

what i want to achieve:

2 Likes

You could check if the players HumanoidRootPart is touching said part and from there change their HumanoidRootPart Y pos to a said height

sorry for not mentioning this but im trying to make it so the player can still get out of the water :sweat_smile:

add an area where it sets a BoolValues Value property to true and if it is true then their height CANT be changed and make sure to provide land under the water at the area so they dont fall out of the world
Also put said BoolValue in the player’s avater

You could add on an if statement on the water to detect if a player is touching it. In there you can add on body force so you hover in the air. To get out of the water you could try and increase the body force when it reaches a certain position and then change their animation.

this is what i had in mind, its just i had no actual idea on how to accomplish it

Well for hovering in the air as if it is Zero Grav is kinda hard. I just made a zero grav chamber and even tho i got it to work basicly perfectly the players avatar would still move a little bit up

Do you mean like adding on the body force and changing animations?

If you want to try here is what i did for my zero grav area. You may have to change it up bit to work for water

local ZeroGravRegion = Region3.new(workspace.ZeroGravHelp.Part1.Position, workspace.ZeroGravHelp.Part2.Position)

print(ZeroGravRegion.CFrame)
print(ZeroGravRegion.Size)

local AntiGrav = 1
local gravforce = 196.2 * 1
print(gravforce)

while true do
	for i, part in pairs(workspace:FindPartsInRegion3(ZeroGravRegion)) do
		local h = part.Parent:FindFirstChild("Humanoid")
		if h then
			if part.Parent.HumanoidRootPart:FindFirstChild("BodyForce") == nil then
				if part.Anchored == false then
					local bforce = Instance.new("BodyForce")
					bforce.force = Vector3.new(0, ((part.Parent.HumanoidRootPart:getMass())*gravforce)* 5.115, 0)
					bforce.Parent = part.Parent.HumanoidRootPart
				end
			end
		else
			h = part.Parent.Parent:FindFirstChild("Humanoid")
			if h then
				if part.Parent.Parent.HumanoidRootPart:FindFirstChild("BodyForce") == nil then
					if part.Anchored == false then
						local bforce = Instance.new("BodyForce")
						bforce.force = Vector3.new(0, ((part.Parent.Parent.HumanoidRootPart:getMass())*gravforce)* 5.115, 0)
						bforce.Parent = part.Parent.Parent.HumanoidRootPart
					end
				end
			else
				if part:FindFirstChild("BodyForce") == nil then
					if part.Anchored == false then
						local bforce = Instance.new("BodyForce")
						bforce.force = Vector3.new(0, ((part:getMass())*gravforce)* 5.115, 0)
						bforce.Parent = part
					end
				end
			end
		end
	end
	wait()
end

adding on body force to make it up

I am pretty sure 1000 as the Y in the force property makes you hover. But I am not entirely sure.

nope. For mine i had to do this math problem in the script

((part.Parent.HumanoidRootPart:getMass())*gravforce)* 5.115

just to get the players avatar to float kinda because every roblox avatar has a different Max amount i believe and for my avatar the Y power to kinda float is 2809.976