Gauge With Spinning Needle

Hello everyone. I’m trying to make a simple gauge that has a moving needle. As of now, it doesn’t take in any input and I just want it to move in circles infinitely. The needle is made up of a base, and a needle part which through welds is attached to the base. I’ve seen one other post about this topic but it hadn’t worked for me. I’m not sure how to implement this functionality through scripts so all help is appreciated.

When your script starts you can save your needle’s “zero” position. Then when you want to move it, you can use CFrame.fromAxisAngle(axis, angle), where axis is the axis you want it to rotate around.

--Assuming you use legacy Weld (not WeldConstraint)
--A hinge would also work but the name of the CFrame is different
local zeroCFrame = gaugeBack.NeedleWeld.C1
local needleValue = 0

while true do
wait(0.1)
needleValue += 0.1
gaugeBack.NeedleWeld.C1 = zeroCFrame * CFrame.fromAxisAngle(Vector3.zAxis, needleValue)
end

This will spin the needle 0.1 radians every 0.1 seconds.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.