How to make a part float in part water?

how could I make a part float up to the surface in a part like how low mass parts float in normal terrain water? Im using this system: High performance water: Swimmable part 2.0 - #82 by varuniemcfruity which does basically everything normal terrain water does but make parts float. please help me

Insert BodyPosition inside of floating part and create script:

game:GetService(“RunService”).Stepped:Connect(function()
local pos = floatingPart.Position * Vector3.new(1, 0, 1)
pos += Vector3.new(0, waterPart.Position.Y + waterPart.Size.Y / 2, 0)
floatingPart.BodyPosition.Position = pos
end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.