Boat script occasionally failing to work

So I am trying to fix my friends boat script, I have tried printing it out with no luck, sometimes when spawned in through replicated storage it will float and work correctly sometimes not, I have a taken into account to disable the script in replicated storage and activate when spawned in, but I just cant figure out why its only working part of the time.

prop = script.Parent:WaitForChild("Propeller")

vehicleseat = script.Parent:WaitForChild("VehicleSeat")

vehicleseat.MaxSpeed = 50 -- change this for speed

engine = prop:WaitForChild("Engine")

steer = engine:WaitForChild("Steering")

particles = engine:WaitForChild("ParticleEmitter")

thrust = engine:WaitForChild("BodyThrust")

maxSteer = 40

minSteer = 20

steer.ServoMaxTorque = 1.5 * 10^4

steer.AngularSpeed = vehicleseat.TurnSpeed

multiplier = 1.3 * 10^1

mass = 0

for i, v in pairs(script.Parent:GetChildren()) do

if v:isA("BasePart") then

mass = mass + v:getMass()



function checkIfPointUnderWater(position)

local point = workspace.Terrain:WorldToCell(position)

local center = workspace.Terrain:CellCenterToWorld(point.X, point.Y, point.Z)

local region =,2,2),,2,2))

local material = workspace.Terrain:ReadVoxels(region, 4)

return material[1][1][1] == Enum.Material.Water



if checkIfPointUnderWater(engine.Position) then

thrust.Force =,0,-vehicleseat.Throttle * vehicleseat.Torque)*mass*multiplier * math.min(1, 2 - vehicleseat.Velocity.magnitude / vehicleseat.MaxSpeed)

particles.Speed =

particles.Enabled = true

if vehicleseat.Throttle < 0 then

thrust.Force = thrust.Force / 4

particles.Speed =



particles.Enabled = false

thrust.Force =


steer.TargetAngle = -vehicleseat.Steer * (maxSteer - (vehicleseat.Velocity.magnitude / vehicleseat.MaxSpeed)*(maxSteer-minSteer))

1 Like

pls paste your code as code, thx

A few things:

  • When you say “printing it out with no luck”, do you mean nothing at all was printed or that it didn’t fix your problem?
  • Did you receive any errors for both when it did work and when it didn’t work?
  • Please for the love of everyone on here, please wrap your code in the code blocks. (on the formatting bar at the top the box when you post something)

I mean it only prints when it works, and theres one error that occurs even if it works, other then that no, and ill try to fix the formatting now lol

What’s the error that occurs? It could be important- y’know, everything’s on the table when it comes to finding a solution.

12:48:37.325 - LoadLibrary is deprecated and is going to be removed imminently; see LoadLibrary is going to be removed on January 6th for details

12:48:37.326 - Stack Begin

12:48:37.326 - Script ‘Workspace.DatBoat.Welder’, Line 1

12:48:37.327 - Stack End

12:48:37.331 - Unable to find module for asset id

12:48:37.333 - Stack Begin

12:48:37.334 - Script ‘Workspace.DatBoat.Humanoid.Script’, Line 4

12:48:37.335 - Stack End

Also, what do I use to format it correctly? lol

Also, I don’t see much of the error detail, mind taking a picture of the entire output pertaining ro the goat’s scripts?

1 Like

^ What this guy said

In the output, there are two errors- from two different scripts.
In the OP, which script did you provide?
Workspace.DatBoat.Welder or Workspace.DatBoat.Humanoid.Script?

Please provide the one you haven’t provided as well :slight_smile:

this is the only output i recieve

the humanoid script has nothing to do with it ill post the welder script

Utility = LoadLibrary("RbxUtility")
Create = Utility.Create
Welds = {}
function popFromTable(list, key)
	for i, v in pairs(list) do
		if v["key"] == key then
			local data = v
			table.remove(list, i)
			return data
function quickWeld(node)
	local data = popFromTable(Welds, node)
	local root = node:findFirstChild("Root") or node:getChildren()[1]
	if data == nil then
		data = {key = node, cframe = {}, welds = {}}
		for _,v in pairs(node:getChildren()) do
			if v ~= root and v:isA("BasePart") then 
				table.insert(data["cframe"], {root, root.CFrame:toObjectSpace(v.CFrame), v})
				v.Anchored = false
	for _, v in pairs(data["welds"]) do
	for _,v in pairs(data["cframe"]) do
		if v ~= root then 
			table.insert(data["welds"], Create("Weld"){
				Name = "QuickWeld",
				Part0 = v[1],
				Part1 = v[3],
				C0 = v[2],
				C1 =,
				Parent = v[3]
	root.Anchored = false
	table.insert(Welds, data)

You should not use LoadLibrary as it is going to be removed, as states in the output. The script in the humanoid errors though, are you using the correct assetId ro get a module?

These errors happen even when it works correctly, I also did not make this script, simply trying to fix it for my friend, in the humanoid script its only used to load a explosion, the boat has a humanoid when it dies it explodes, however I redid that script just never took the humanoid script out.
the error is due to trying to load a asset for the explosion

Load Library should work for a limited time , after that it’ll stop as it is depreceated. You should use the modules provided by Roblox here