I have problems with my level system

i will try to figure it out but idk really where i need to put it in the script so i will try you can help if you want but i’m trying first before getting help i will let you know when i got it

You could even think about making the ProgressBar a class.
But that’s fully up to you whether you wanna do that or not.

local ProgressBar = {}
ProgressBar.__index = ProgressBar

function ProgressBar.new(progressBackground, max)
	local bar = {}
	
	bar.progressFrame = progressBackground
	bar.min = 0
	bar.max = max
	bar.value = bar.min
	
	setmetatable(bar, ProgressBar)
	return bar
end

function ProgressBar:update(value, max)
	if typeof(value) == "number" and value >= self.min and value <= self.max then
		self.value = value
	end
	if typeof(max) == "number" and max >= self.min then
		self.max = max
	end
end

function ProgressBar:render()
	self.progressFrame.Size = UDim2.new(math.clamp(self.value / self.max, 0, 1), self.frames.progress.Size.X.Offset, self.frames.progress.Size.Y.Scale, self.frames.progress.Size.Y.Offset)
end

return ProgressBar

maybe i’m really dumb but idk what a class is lol

Ah, then just leave it as you have it right now.
You’ll learn about it later. Good luck!

1 Like

ty for helping me if you didn’t help me i didn’t fix this!

i can’t really find it i did this and it does not work i think i did something wrong

it says in the output argument 2 missing or nil