So, I’m trying to make a menu where when you buy something it takes money away from you and If you don’t have enough money you can’t buy it.
function player_meta:TakeMoney( amount )
if self:HasMoney( amount ) then
self:SetPData( MoneyIdentity, self:GetPData( MoneyIdentity ) - amount );
self:SetNWInt( MoneyIdentity, self:GetPData( MoneyIdentity ) );
function player_meta:HasMoney( amount )
if self:GetPData( MoneyIdentity ) >= amount then – Line 34
The only problem is that If I don’t have enough money it still lets me buy the item.
This is the Error I have:
moneysystem.lua:34] attempt to compare number with string
If someone could help me out that would be great.