Need help with gauges for my nuclear reactor game

Hello developers,

Im currently in the works of making an advanced RBMK reactor simulator with full physics simulation, to do this, i need a certain gauge called ‘Reactor Period’ it displays how long until reactor power doubles (in seconds)
{5394EE2C-4D3D-47F7-8800-08ADED801AD0}

Problem is the numbers on the gauge arent evenly spaced say like the SRM gauge:
{E36BF1E4-6B57-4567-B506-30D2BE4F0CF5}

This means that the number displayed on the period gauge is not accurate.

How can I get the slider to display 120 here, and same with all numbers going down:

Instead of here:

For additional info, anything above 240s is considered ‘Infinite’

This is the code that updates the gauge:

function UpdatePeriodGauge(Gauge: Model)
	local Slider = Gauge.Slider
	local startPos = Gauge.Start.Position
	local endPos = Gauge.End.Position

	local min = Gauge:GetAttribute("Min")
	local max = Gauge:GetAttribute("Max")

	local Value = math.clamp(Gauge:GetAttribute("Number"), max, min)

	local normalized = (Value - min) / (max - min)
	local newPos = startPos:Lerp(endPos, normalized)

	local Tween = TweenService:Create(Slider, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0), {Position = newPos})
	Tween:Play()
end
1 Like

You could save the position data of the gauge to a table so you can accurately and easily tween the slider. The table would look like this:

local SliderData = {
	[120] = Vector3.zero,
	[60] = Vector3.one,
	--Others here
}

--Indexing
local NewPosition = SliderData[120] --> 0, 0, 0
1 Like

This just sent the slider to 0,0,0

I meant like input the position onto the table :skull:
Those were placeholders…

Oh, im tired rn lol :skull: charsssssss

worked, thank you so much! (chazzzzzz)