1

# Why isn't the code working when the part is welded?

Xyternal 145
17 days ago

So I was searching up some YouTube tutorial videos, and I wanted to make my boat move. Here is my code.

local Engine = game.Workspace.car.Model.Engine.BodyThrust --The Force making the boat move
local SForce = game.Workspace.car.Steer.BodyAngularVelocity -- The force making the boat turn
local DSeat = script.Parent -- The driver seat
local Base = game.Workspace.car.Model.Base -- The base part of the boat

speed = 5000 -- The force of 'Engine'
SteerSpeed = 25 -- The force of SForce
BaseDensity = .1 -- Lower this is your boat can't float, make it higher to make it go more in the water

DSeat.Changed:Connect(function(p)
if p == "ThrottleFloat"then
Engine.Force = Vector3.new(0,0,speed * DSeat.ThrottleFloat)
end
if p == "SteerFloat"then
SForce.AngularVelocity = Vector3.new(0,-SteerSpeed*DSeat.SteerFloat,0)
end
end)

Base.CustomPhysicalProperties = PhysicalProperties.new(BaseDensity,0,0)


So it works when I test it without welding the engine, but when i weld the engine, the boat doesn't move. One more question... I have a drivers seat, and do i need a script to make it move? Please answer my questions. Thanks!

0

Yeah I think you need to script It to move

0
Can you tell me whats wrong though. Xyternal 145 — 17d
0
wydm? imnotaguest1121 0 — 17d
0
Like whats wrong in the code. So I got my answer to my second question, now i want the answer to my first Xyternal 145 — 17d
0
Xapelize 1835
17 days ago
Edited 17 days ago

Hey! I believe that you are trying to move an entire boat, but it looks like your welded part is anchored! That's why it wont move, you should make it as a model, and go to the model > properties > PrimaryPart, set it to the base part of the boat.

Now you should move it with :SetPrimaryPartCFrame, rotating it need to use math.Angles, just a note, every orientation you put should do math.rad. Heres a sample:

for i = 1, 100, 1 do