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

How do you change the "VehicleSeat" controls?

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

✓ Accepted answer

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.

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