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

How do you change the "VehicleSeat" controls?

Asked by
painzx3 43
9 years ago

I want to change the control scheme for a turret so that instead of WASD, its something like IJKL. Below is the script named Control and Control 2.

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

and this is the script Control2

angle = 0

while true do
wait()
if script.Parent.Throttle == 1 and angle < 20 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 > -5 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

1 answer

Log in to vote
0
Answered by 9 years ago

You can try a ButtonDown(key) function. Although you would need to do some things to make it work. Like put it into a localscript or something... Also, for the key thing, you can do something like this:

if key == J then

or

if string.byte(key) == 106 then--74 is for uppercase J. 

The string.byte(key) code is here. You use the numbers under the DEC.

Ad

Answer this question