Random function help.

I’m trying to code a weapon so it will fire a random prop. But I’m having difficulty implementing it due to the fact that I kinda suck.

Here is the fire function.

function SWEP:PrimaryAttack()
if ( !self:CanPrimaryAttack() ) then return end

	self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )


How could I have it so there are multiple functions like that? and it chooses them randomly?

You set up a table in your SWEP, containing all possible models to throw:

SWEP.ToThrow = {
    "mdl2.mdl" -- You get the point

And then you pass a random value to your throw_attack from that table:

self:throw_attack(self.ToThrow[math.random(1, #self.ToThrow)])

you da best!