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

Why won't this move the object?

Asked by
painzx3 43
10 years ago

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

0
Any errors in the output? RedCombee 585 — 10y
0
Nope painzx3 43 — 10y
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 painzx3 43 — 10y

1 answer

Log in to vote
0
Answered by
Spooce 78
10 years ago

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

Ad

Answer this question