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:
01 | local seat = script.Parent |
02 | local velocity = seat.Parent.BodyVelocity |
03 |
04 | seat.Changed:connect( function (property) |
05 | if property = = "Throttle" then -- You are trying to go forward. |
06 | velocity.Velocity = Vector 3. new( 10 , 0 , velocity.Velocity.Z) -- You might want to change this depending on how your boat is rotated. |
07 | elseif property = = "Steer" then -- You are trying to turn. |
08 | velocity.Velocity = Vector 3. new(velocity.Velocity.X, 0 , 10 ) -- You might want to change this depending on how your boat is rotated. |
09 | end |
10 | 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:
01 | script.Parent.MaxSpeed = 500 |
02 | script.Parent.BodyPosition.position = script.Parent.Position |
03 | script.Parent.BodyGyro.cframe = script.Parent.CFrame |
04 | value 1 = 0 |
05 | while true do |
06 | wait() |
07 | if script.Parent.Throttle = = 1 then |
08 | if value 1 < 41 then value 1 = value 1 + 1 end |
09 | script.Parent.BodyVelocity.velocity = script.Parent.CFrame.lookVector*value 1 |
10 | end |
11 | if script.Parent.Throttle = = 0 then |
12 | value 1 = 0 |
13 | script.Parent.BodyVelocity.velocity = script.Parent.CFrame.lookVector*value 1 |
14 | end |
15 | if script.Parent.Throttle = = - 1 then |
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.
01 | script.Parent.MaxSpeed = 20 |
02 | script.Parent.BodyPosition.position = script.Parent.Position |
03 | script.Parent.BodyGyro.cframe = script.Parent.CFrame |
04 | value 1 = 0 |
05 |
06 | while true do |
07 | wait() |
08 | if script.Parent.Throttle = = 1 then |
09 | if value 1 < 18 then value 1 = value 1 + 0.5 end -- The 18 should be around the MaxSpeed |
10 | script.Parent.BodyVelocity.velocity = script.Parent.CFrame.lookVector*value 1 |
11 | end |
12 | if script.Parent.Throttle = = 0 then |
13 | if value 1 > = 0.25 then |
14 | value 1 = value 1 - 0.25 |
15 | elseif value 1 < = - 0.25 then |