Buoyancy Boat Broken!

What am I doing?
Hello guys! I want to make a boat on Roblox with my own buoyancy system with my own water.

What is the issue?
When I’m on the floaty thingy, it jitters and slowly pushes me off into a different direction.

Describing the system here:
The platform has 4 floaty points, and it experiences drag and angular drag at the center.

The one script in it:

local obj = script.Parent
local lineardrag = 7
local rotationaldrag = .1

local floatypoints = {script.Parent.F1,script.Parent.F2,script.Parent.F3,script.Parent.F4}
game["Run Service"].Heartbeat:Connect(function()
	if script.Parent.AssemblyMass > 10000 then return end--Is Anchored?
	script.Parent:SetNetworkOwner(nil)
	
	for i,v in pairs(floatypoints) do--buoyancy calculations
	v.Buoyancy.Force = 
		Vector3.new(0,
				1*workspace.Gravity*(script.Parent.Size.X*script.Parent.Size.Z)/4*script.Parent.Size.Y*
			math.clamp((workspace.Water.Water.Position.Y-(v.WorldPosition.Y
				-script.Parent.Size.Y/2))/script.Parent.Size.Y,0,1),0)
	end

	if workspace.Water.Water.Position.Y < script.Parent.Position.Y - script.Parent.Size.Y/2 then return end
	script.Parent.Center.Drag.Force = -script.Parent.AssemblyLinearVelocity * script.Parent.AssemblyMass * lineardrag--linear drag
	script.Parent.AssemblyAngularVelocity *= math.exp(-rotationaldrag)--angular drag
end)

What solutions have I tried so far?
-I’ve tried changing the network ownership to the server
-I’ve tried setting the velocity to 0 if the boat or player’s assembly velocity was too small
-I have considered using align orientation, linear velocity, and align position instead, but then the boat would be too stiff (I want it to be able to be pushed around and stuff by say a bigger boat or something, if there is a way the boat can still be push able with these and fix my problem, please let me know)

Could you big brains out there help me out with stabilizing the boat, or finding more things to improve upon the script please?

I need help fast, or else floppa might drown from my lousy coding!
image_2022-06-10_010952467

1 Like

I’m not sure about whether my solution would work here.

But adding an attachment from player to the boat could be a possible solution. This ensures that your character will remain on the boat without moving.

Gmor_cad’s idea does sound like it could work, but im very trash at coding and have no idea how to implement that, as well as how it would detect when a player is moving or being moved to detatch the attatchment.

+I think I have more information to add, when I made the boat on the client, everything went perfectly fine, this glitch has something to do with forces on the server and client…

Also I forgot to report another problem earlier on the server, the boat’s forces would go “numb” on the client and slowly sink, while remaining on the same position in the server, then the two would correct each other and the boat on the client would snap back in place, very strange. AND also uh its not really jittering me off, more like jittering me to the center of the boat.

From what I saw, Gmor’s idea meant that you could add a weld to the character to prevent it from moving around.
Example code (doesn’t check for if already welded):

local boat = script.Parent
boat.Touched:Connect(function(otherPart)
 local weld = Instance.new("Weld")
 weld.Parent = boat
 weld.Part0 = boat
 weld.Part1 = otherPart
end)

This way, Floppa won’t drown! Unless of course, the boat sinks.

I guess it would prevent the player from jittering around, but I still want the player to able to move around the boat or be pushed around if they’re pushed

You might need to check some tutorials on how to make that work, since I’m not that skilled on making these kinds of things work.