Pointshop Points over Time for Donators

Hi all, currently trying to set up a thing that gives three groups, Donators, DonatorsPlus, and DonatorMods, more points than regular players.

The issue is, it gives normal players points but gives a return error if you’re one of the listed groups for extra points.

I’ve adjusted my sv_player_extension PointsOverTime to look like this



if PS.Config.PointsOverTime then
		timer.Create('PS_PointsOverTime_' .. self:UniqueID(), PS.Config.PointsOverTimeDelay * 60, 0, function()
			
			if !IsValid(self) then return end
           
			if self:IsUserGroup("donator" ) then
                                self:PS_GivePoints(PS.Config.PointsOverTimeDonator)
			elseif self:IsUserGroup ("DonatorPlus") then
				self:PS_GivePoints(PS.Config.PointsOverTimeDonatorPlus)
			elseif self:IsUserGroup ("DonatorMod") then
				self:PS_GivePoints(PS.Config.PointsOverTimeDonatorMod)
            else
                self:PS_GivePoints(PS.Config.PointsOverTimeAmount)
            end
					
		self:PS_Notify("You've been given ", PS.Config.PointsOverTimeAmount, " ", PS.Config.PointsName, " for playing on the server!")
		
		end)
	end


and my sh_config looks like this



PS.Config.PointsOverTime = true -- Should players be given points over time?
PS.Config.PointsOverTimeDelay = 10 -- If so, how many minutes apart?
PS.Config.PointsOverTimeAmount = 20 -- And if so, how many points to give after the time?
PS.Config.PointsOverTimeDonator = 30 -- Donator Rank +10 extra points per 10 minutes
PS.Config.PointsOverTimeDonatorPlus = 35 -- Donator Rank +15 extra points per 10 minutes
PS.Config.PointsOverTimeDonatorMod = 35 -- Moderator + Donator Rank


the error i get back is as follows

line 146 looks like the following if anyone was wondering



function Player:PS_GivePoints(points)
	self.PS_Points = self.PS_Points + points
	self:PS_SendPoints()
end


where am i going wrong?

Something is sending a non-number into SetPoints. Also, that code you posted will never work since self refers to the table the function is part of, which is none since it isn’t in a function.

thats because its part of a function is


function Player:PS_PlayerInitialSpawn()

its part of that function. Or maybe I’m misunderstanding. I’ve taken the code pretty much directly from other peoples on here that had the same issue; it worked for them but they only had 1 group other than users that were receiving extra points - mine has 3.

Try print the values of how many points should be given one by one before you give them. If it prints nil make sure you actually saved your config. …

Also I think theres a update or two to your pointshop.