So basically, I wanted a valve wheel, that when a player presses "E" once then it rotates to the right, and when the player presses "E" again it rotates to the left.
But in the current form of the script, it only rotates to the right, and doesn't change the value as it should change it.
The script:
local prox = script.Parent.wheel.ProximityPrompt
local value = script.Parent.Value.Value
prox.Triggered:Connect(function()
for i = 1, 10, 1 do
if value == "false" then
value = "true"
script.Parent.wheel.CFrame = script.Parent.wheel.CFrame * CFrame.fromEulerAnglesXYZ(0.5,0,0) * CFrame.new(0, 0, 0)
script.Parent.rod.CFrame = script.Parent.rod.CFrame * CFrame.fromEulerAnglesXYZ(0.5,0,0) * CFrame.new(0, 0, 0)
wait(0.05)
else
for i = 1, 10, 1 do
value = "false"
script.Parent.wheel.CFrame = script.Parent.wheel.CFrame * CFrame.fromEulerAnglesXYZ(-0.5,0,0) * CFrame.new(0, 0, 0)
script.Parent.rod.CFrame = script.Parent.rod.CFrame * CFrame.fromEulerAnglesXYZ(-0.5,0,0) * CFrame.new(0, 0, 0)
wait(0.05)
end
end
end
end)

2 comments
Not sure why, but these scripts won't rotate the valve wheel
what are you rotating, the wheel? or other things connected by constraints