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

The scripts below aren't rotating the object. Help fix?

Asked by
painzx3 43
9 years ago

I have a modified howitzer. The two scripts control and control2 appear like they control the rotation of the cannon left and right. However, whenever I test in studio, it does not rotate left or right when I press A or D which default for a VehicleSeat. The scripts are below, I am looking for a solution and the only errors I see in the output is this:23:20:56.727 - Players.Player1.PlayerGui.VehicleGui.Frame.Script:131: attempt to index global 'sabot' (a nil value)

CONTROL

while true do
wait()
if script.Parent.Steer == 1 then
script.Parent.Swiv:play()
script.Parent.Parent.WER.Value.C0 = script.Parent.Parent.WER.Value.C0 * CFrame.fromEulerAnglesXYZ(0,0.01,0)
elseif script.Parent.Steer == -1 then
script.Parent.Swiv:play()
script.Parent.Parent.WER.Value.C0 = script.Parent.Parent.WER.Value.C0 * CFrame.fromEulerAnglesXYZ(0,-0.01,0)
elseif script.Parent.Steer == 0 and script.Parent.Throttle == 0 then
script.Parent.Swiv:pause()
end
end

CONTROL2

angle = 0

while true do
wait()
if script.Parent.Throttle == 1 and angle < 80 then
script.Parent.Swiv:play()
angle = angle + 1
script.Parent.Parent.WER2.Value.C0 = script.Parent.Parent.WER2.Value.C0 * CFrame.fromEulerAnglesXYZ(-0.01,0,0)
elseif script.Parent.Throttle == -1 and angle > -15 then
script.Parent.Swiv:play()
angle = angle - 1
script.Parent.Parent.WER2.Value.C0 = script.Parent.Parent.WER2.Value.C0 * CFrame.fromEulerAnglesXYZ(0.01,0,0)
end
end

Answer this question