ProgressBar propcount (Derma)

Hey guys, I’ve been messing around with some Derma (ProgressBar specifically (ProgressBar made by Garry)) and I wanted to make the bar to count props on the server. I was not sure how to go about doing this, so I tried:

local bum = 0 – The amount of props

function SpawnedProp(ply, model, ent) – Adds 1 to bum everytime a prop spawned
bum = bum + 1

hook.Add(“PlayerSpawnedProp”, “playerSpawnedProp”, SpawnedProp)

local myProgressBar = vgui.Create( “DProgressBar” , DermaPanel)
myProgressBar:SetSize( 150, 40 )
myProgressBar:SetPos( 25, 25 )
myProgressBar:SetMin( 0 )
myProgressBar:SetValue(bum) – this is the “propamount” being displayed.

I do this and it just displays 0 all the time (I’m very new to Lua)

Help would be appreciated.

The SetValue has to be in a hook, which is called for example every frame,

Also,i would change the PlayerPropSpawn with that:

For k,v in pairs(ents.FindByClass(“prop_physics”) do
bum = bum + 1

Now,you just need a hook/timer, and you should be OK

local propcount = #ents.FindByClass(“prop_physics”)