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!
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 game.Workspace.Model:SetPrimaryPartCFrame(0, i, 0) * math.Angles(math.rad(10), 0, math.rad(50)) end
Yeah I think you need to script It to move