I’ve recently received a script, basically all I wanted was if you press “E” on the proximity prompt once the valve wheel spins to the right, and when you press it again it spins to the left. But this script doesn’t spin the wheel, why?
local prox = script.Parent.wheel.ProximityPrompt
local value = script.Parent.wheel.Value
prox.Triggered:Connect(function()
if value == "false" then
value = "true"
for i = 1, 10, 1 do
script.Parent.wheel.CFrame = script.Parent.wheel.CFrame * CFrame.fromEulerAnglesXYZ(0.5,0,0) * CFrame.new(0, 0, 0)
wait(.05)
end
else
value = "false"
for i = 1, 10, 1 do
script.Parent.wheel.CFrame = script.Parent.wheel.CFrame * CFrame.fromEulerAnglesXYZ(-0.5,0,0) * CFrame.new(0, 0, 0)
wait(.05)
end
end
end)
I’m assuming the value is a boolvalue, so make sure your values are inputted correctly.
local prox = script.Parent.wheel.ProximityPrompt
prox.Triggered:Connect(function()
local value = script.Parent.wheel.Value
if value == false then
value = true
for i = 1, 10, 1 do
script.Parent.wheel.CFrame = script.Parent.wheel.CFrame * CFrame.fromEulerAnglesXYZ(0.5,0,0)
wait(.05)
end
else
value = false
for i = 1, 10, 1 do
script.Parent.wheel.CFrame = script.Parent.wheel.CFrame * CFrame.fromEulerAnglesXYZ(-0.5,0,0)
wait(.05)
end
end
end)
If it isn’t a boolvalue, change teh value to a boolvalue
local prox = script.Parent.wheel.ProximityPrompt
prox.Triggered:Connect(function()
local value = script.Parent.wheel.Value
if value == false then
script.Parent.wheel.Value = true
for i = 1, 10, 1 do
script.Parent.wheel.CFrame = script.Parent.wheel.CFrame * CFrame.fromEulerAnglesXYZ(0.5,0,0)
wait(.05)
end
else
script.Parent.wheel.Value = false
for i = 1, 10, 1 do
script.Parent.wheel.CFrame = script.Parent.wheel.CFrame * CFrame.fromEulerAnglesXYZ(-0.5,0,0)
wait(.05)
end
end
end)