I'm making a game need boats to move but I don't know how to make a boat can move in Roblox water terrain. I have try use some script but is not work and I don't know why. Can someone help me do this? Thank for all!
Use a VehicleSeat
with your boat model and it should work.
Try a VechicleSeat
with your boat (like incapaz said) and then you have an option for welding:
a. You can use a welding script from the toolbox.
b. You can use weld constraints.
c. Simply put welds on the part itself.
Hope this helps!
EDIT:
So, the VehicleSeat is not working. This is probably the problem: The VehicleSeat should be referenced by a script.Here are the steps:
- Weld all the parts together.
- Create a BodyVelocity on one of the parts.
- Set the
MaxForce
to a high number.- Add a VehicleSeat to the boat that is also welded.
- Add the script with the code below to the VehicleSeat:
local seat = script.Parent local velocity = seat.Parent.BodyVelocity seat.Changed:connect(function(property) if property == "Throttle" then -- You are trying to go forward. velocity.Velocity = Vector3.new(10, 0, velocity.Velocity.Z) -- You might want to change this depending on how your boat is rotated. elseif property == "Steer" then -- You are trying to turn. velocity.Velocity = Vector3.new(velocity.Velocity.X, 0, 10) -- You might want to change this depending on how your boat is rotated. end end)
Hope this helps!
treat it as actual water, the density of all parts of the boat will decide rather if the boat sinks of floats, i usually use bodythrust to move boats in water, and i definitely recommend using a body gyro so that it wont capsize
Ok so, all you have to do is add a VehicleSeat and add inside of it a, BodyGyro, BodyPosition, and a BodyVolocity then add a script inside the VehicleSeat and Paste/Type this in:
script.Parent.MaxSpeed = 500 script.Parent.BodyPosition.position = script.Parent.Position script.Parent.BodyGyro.cframe = script.Parent.CFrame value1 = 0 while true do wait() if script.Parent.Throttle== 1 then if value1 < 41 then value1 = value1+1 end script.Parent.BodyVelocity.velocity = script.Parent.CFrame.lookVector*value1 end if script.Parent.Throttle == 0 then value1 = 0 script.Parent.BodyVelocity.velocity = script.Parent.CFrame.lookVector*value1 end if script.Parent.Throttle== -1 then if value1<31 then value1 = value1+1 end script.Parent.BodyVelocity.velocity = script.Parent.CFrame.lookVector*-value1 end if script.Parent.Steer == 1 then script.Parent.BodyGyro.cframe = script.Parent.BodyGyro.cframe * CFrame.fromEulerAnglesXYZ(0,-.1,0) end if script.Parent.Steer == -1 then script.Parent.BodyGyro.cframe = script.Parent.BodyGyro.cframe * CFrame.fromEulerAnglesXYZ(0,.1,0) end end ----the plate boat script is by Starmarine5405 on scriptinghelpers.org
or take this model: https://web.roblox.com/catalog/03540884212/redirect
Here, I made an updated version of StarMarine5405's script. The slowing down and reversing is smoother now.
I also changed some speed variables to fit my design, but those do not need to be changed.
script.Parent.MaxSpeed = 20 script.Parent.BodyPosition.position = script.Parent.Position script.Parent.BodyGyro.cframe = script.Parent.CFrame value1 = 0 while true do wait() if script.Parent.Throttle== 1 then if value1 < 18 then value1 = value1+0.5 end -- The 18 should be around the MaxSpeed script.Parent.BodyVelocity.velocity = script.Parent.CFrame.lookVector*value1 end if script.Parent.Throttle == 0 then if value1 >= 0.25 then value1 = value1 - 0.25 elseif value1 <= -0.25 then value1 = value1 + 0.25 end script.Parent.BodyVelocity.velocity = script.Parent.CFrame.lookVector*value1 end if script.Parent.Throttle== -1 then if value1>=-10 then value1 = value1-0.5 end -- The 10 is the maximum reverse speed script.Parent.BodyVelocity.velocity = script.Parent.CFrame.lookVector*value1 wait() end if script.Parent.Steer == 1 then script.Parent.BodyGyro.cframe = script.Parent.BodyGyro.cframe * CFrame.fromEulerAnglesXYZ(0,-.02,0) -- Change -.02 to your turn speed value (negative) end if script.Parent.Steer == -1 then script.Parent.BodyGyro.cframe = script.Parent.BodyGyro.cframe * CFrame.fromEulerAnglesXYZ(0,.02,0) -- Change .02 to your turn speed value end end ----the plate boat script is by Starmarine5405 and modified by BetaTrivus on scriptinghelpers.org