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

Why won't this move the object?

This script is in a "VehicleSeat" and is supposed to rotate the model when the person pressed A or D. Here's the two scripts. This is Control

angle = 0

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

and this is Control2

angle = 0

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

3 comments

0

Any errors in the output?

0

Nope

0

23:15:51.203 - Workspace.Model.Model.VehicleSeat.Control:12: attempt to index field 'Value' (a nil value) that was the error. I didn't see it

1 answer

✓ Accepted answer

You didn't use onKeyDown() to tell which key needs to be pressed to activate it.

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