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

Boat script working last night but broke? [STILL NEED Help]

Ok the problem was it wasn't working yesterday in play mode but in build mode it worked then I converted it to local script and it worked. Now it won't work for some reason and it's a local script.

script.Parent.BodyPosition.position = script.Parent.Position
script.Parent.BodyGyro.cframe = CFrame.fromEulerAnglesXYZ(0,3.14,0)
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

-Vetexgames

1 answer

Try putting a wait() before everything else. That's a problem with localscripts for some reason I dunno. You're also missing an end. Another thing is that localscripts only run in the playergui/backpack or character model.

wait()
script.Parent.BodyPosition.position = script.Parent.Position
script.Parent.BodyGyro.cframe = CFrame.fromEulerAnglesXYZ(0,3.14,0)
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 -- This doesn't have an end to it
if value1<31 then value1 = value1+1 end
script.Parent.BodyVelocity.velocity = script.Parent.CFrame.lookVector*-value1
end
-- If it stops here, put an end here
if script.Parent.Steer == 1 then
script.Parent.BodyGyro.cframe = script.Parent.BodyGyro.cframe * CFrame.fromEulerAnglesXYZ(0,-.1,0)
end
-- If it stops here, put an end here
if script.Parent.Steer == -1 then
script.Parent.BodyGyro.cframe = script.Parent.BodyGyro.cframe * CFrame.fromEulerAnglesXYZ(0,.1,0)
end
-- If it stops here, put an end here
end

2 comments

0

Still won't work :/

0

Any errors? If not, have you read all the comments?

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