How to make this slider oscillates?

https://gyazo.com/50b7df5fddb33eb01d0f8431b3bfc245

I want the bar to go down when it’s full and then increase back when it’s 0

something like this: https://devforum-uploads.s3.dualstack.us-east-2.amazonaws.com/uploads/original/4X/4/b/4/4b44faab92c00b3a8f0ff765daefb6e7df13f631.mp4

function gui:StartSlider()
	print("starts")
	
	local PlayerGui = PlayerService.LocalPlayer.PlayerGui.Main
	
	Connection = RunService.Heartbeat:Connect(function(deltatime)

		value = math.clamp(value + 1, 0, 100)
		PlayerGui.Slider.PowerEmptyBlack.Power.Size = UDim2.new(value / 100, 0,1, 0)
		
		if value == 100 then
			value = math.clamp(value - 1, 0, 0)
		end
		
	end)
	
	return value
end

I think you should readjust the max and min value of the function like so:

value = math.clamp(value - 1, 100, 0)

that gives me an error
image

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