Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a working boat in new Roblox water terrain???

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!

5 answers

Use a VehicleSeat with your boat model and it should work.

3 comments

0

I have try to use VehicleSeat like you say but it still not work! Please help me.

0

Is it anchored?

0

no, it use weld because if I anchor it, it can't move in the water

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:

  1. Weld all the parts together.
  2. Create a BodyVelocity on one of the parts.
  3. Set the MaxForce to a high number.
  4. Add a VehicleSeat to the boat that is also welded.
  5. 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!

3 comments

0

I have try use weld with my boat too but it still not work

0

Try using this script. It should work better.

0

if this script doesn't work try mine, it will be posted soon. works perfectly on 7/26/2019

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

2 comments

0

Thanks! This was very useful. I posted a modified version that is a bit smoother, but yours was a big help!

0

It didn't work for me. :(

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

This discussion is preserved as it was. New answers, comments, and votes are closed.