Help with simple shit script i made? swep giving prop

Okay, so this is the first ever script i made. Its an prop that gives out a swep. I currently have it done, but i want to add that if the player has less than its price they get an error message and the function is abandoned.


AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
 
include("shared.lua")
 
function ENT:Initialize()
 
    self:SetModel("models/teh_maestro/popcorn.mdl")
    self:SetMoveType(MOVETYPE_VPHYSICS)
    self:SetSolid(SOLID_VPHYSICS)
    self:SetUseType( SIMPLE_USE )
   
    local phys = self:GetPhysicsObject()
 
    if phys:IsValid() then
 
        phys:Wake()
 
    end
 
end
 
function ENT:Use(a , c)
for k, v in pairs(c:GetWeapons()) do
if v:GetClass() == "weapon_popcorn" then
end
end
 
c:addMoney(-100)
c:Give("weapon_popcorn")
end

This is currently what i have. I tried this, but i didnt get it to work


if LocalPlayer().DarkRPVars.money < c.addMoney then
        SwepDrop:SetDisabled( true )
        SwepDrop:SetToolTip("Sorry, you cannot afford this item.")

if anyone could help me then either respond here or add me on https://steamcommunity.com/id/Kirexks/

Try replace
c.addMoney
With
The number you want to charge EG: 100
Also swap the comparison sign round so its >


function ENT:Use(_, pPlayer)
	if (pPlayer:HasWeapon("weapon_popcorn")) then -- Check if the player already has the weapon
		pPlayer:ChatPrint("You already have a popcorn!")
	elseif ((pPlayer:getDarkRPVar("money") or 0) < 100) then -- Check if they don't have enough money
		pPlayer:ChatPrint("Insufficient funds!")
	else
		pPlayer:addMoney(-100)
		pPlayer:Give("weapon_popcorn")
	end
end

[editline]14th January 2017[/editline]

You can add your own disabled functions where the ChatPrints are.