PointsService = game:GetService("PointsService") Stat = "KOs" game.Players.PlayerAdded:connect(function(p) repeat wait() until p:FindFirstChild("leaderstats") ~= nil repeat wait() until p.leaderstats:FindFirstChild(Stat) ~= nil repeat wait() until p:FindFirstChild("Need") ~= nil p.leaderstats[Stat].Changed:connect(function(prop) print("Value changed!") local need = p:FindFirstChild("Need") print("Found Need") if prop >= need then game:GetService("PointsService"):AwardPoints(p.userId,1) need = need + 5 print("Awarded points and need has went up") end end) end)
Line 11, (if prop >= need then) is bugged. I don't know why it won't find the value of it.
That because it is userdata. You are defining need as
local need = p:FindFirstChild("Need")
And you can't compare it to a number, I think you wanted to defined it as follow
local need = p:FindFirstChild("Need").Value