How to make a slider ui script

So i’m making a slider based off of the player’s karma value but im facing a problem, the slider starts in the middle of the bar but the karma value starts from 0, how would i move the slider correctly,
(When karma = 0 the slider moves to the middle of the bar)

image

any help is appreciated.

1 Like

use value.Changed function:
karma.Value.Changed:Connect(function()
– and then set the silder x position to the karma value
end)

Im trying to find out how to move the slider correctly, if i do karma/maxKarma it wont be starting from the middle, thats the main issue here

wdym u want the slider to move with the karma value??

I do but the slider is starting from the middle when karma = 0, meaning if i use the regular way of moving the slider it wont be accurate and itll act like the slider starts from the left

Does karma equal to karma/maxkarma here or the plain value

here is what you can do;

local Karma = 0
local TotalKarma = 1;

local movingThing = script.Parent.Frame.Frame;

while (true) do
	wait(1)
	Karma = math.random(0,100) * 0.01
	movingThing.Position = UDim2.new(Karma/TotalKarma - movingThing.Size.X.Scale/2,0,0,0)
end