Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 10 years ago

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

Log in to vote
0
Answered by 10 years ago

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
0
Still won't work :/ MrN00bReaper 30 — 10y
0
Any errors? If not, have you read all the comments? hievery1 70 — 10y
Ad

Answer this question