script.Parent.HingeConstraint.ServoMaxTorque = math.huge script.Parent.HingeConstraint.AngularSpeed = 0.1 workspace.off.ClickDetector.MouseClick:Connect(function() script.Parent.HingeConstraint.TargetAngle = 0 end) workspace.off.ClickDetector.MouseClick:Connect(function() script.Parent.HingeConstraint.TargetAngle = 100 end) spawn(function() while wait() do print(script.Parent.HingeConstraint.TargetAngle) end end)
It prints 0 all the time, even when I have clicked on the off part.
Your problem is simple (I think?), you simply had workspace.off.ClickDetector.MouseClick:Connect(function()
for both functions, but I'm assuming you meant to have one of them set to workspace.on
instead. So basically, both of those functions were running whenever workspace.off
was clicked.