Hi, sorry if the title is confusing, I’m not exactly sure what they are called.
I’m trying to make an RBMK game (as seen in my last post) and now I’m moving onto more specific stuff, controls, gauges, etc. I need to make a gauge similar to this one.
Every time I’ve tried to write the code, it either flies completely out of the meter in the wrong direction, or just goes one way forever.
“Gauge” is the part that moves.
Anyone know how to do this?
This is my current code:
--// Variables
local ReactorModule = require(game.ServerScriptService.Reactor)
local Meter = script.Parent
local Gauge = Meter.Gauge
local MeterSettings = {
["MeterLength"] = 1,
}
--// Main
local LastValue
wait(5)
while true do
ReactorModule.AverageRodPositon = math.random(1, 100)
local NewValue = ReactorModule.AverageRodPositon
if NewValue == LastValue then
return
end
local function CalculateNewPositon()
local XPosition = Gauge.Position.X
local YPosition = Gauge.Position.Y
local ZPosition = (Gauge.Position.Z + (MeterSettings.MeterLength/ReactorModule.AverageRodPositon/100))
return Vector3.new(XPosition, YPosition, ZPosition)
end
local Tween = game.TweenService:Create(Gauge, TweenInfo.new(0.3), {Position = Gauge.CFrame.LookVector + CalculateNewPositon()})
Tween:Play()
Tween.Completed:Wait()
LastValue = ReactorModule.AverageRodPositon
wait()
end
Thanks for any and all help!