Code:
PointsService = game:GetService("PointsService") Stat = "KOs" Needed = 5 game.Players.PlayerAdded:connect(function(p) repeat wait() until p:FindFirstChild("leaderstats") ~= nil repeat wait() until p.leaderstats:FindFirstChild(Stat) ~= nil p.leaderstats[Stat].Changed:connect(function(prop) if prop >= Needed then print("Has enough KO's") game:GetService("PointsService"):AwardPoints(p.userId,1) print("Has Been Rewarded") Needed = Needed+5 print("Total Has gone up") end end) end)
Here is the problem with the script.. It will award the player points, 'Needed' Will go up. BUT.. It acts like everyone in the server is the same person, so if anyone reaches the needed it makes it increases it for everyone else. Is there any way to fix this easily?
You have to assign it to a local player using local so:
local Needed = 5
then make the increase local so:
local Needed = Needed +5
Here's what it should be
PointsService = game:GetService("PointsService") Stat = "KOs" local Needed = 5 game.Players.PlayerAdded:connect(function(p) repeat wait() until p:FindFirstChild("leaderstats") repeat wait() until p.leaderstats:FindFirstChild(Stat) p.leaderstats[Stat].Changed:connect(function(prop) if prop >= Needed then print("Has enough KO's") game:GetService("PointsService"):AwardPoints(p.userId,1) print("Has Been Rewarded") local Needed = Needed+5 print("Total Has gone up") end end) end)
You have to do it in a Local Script and have it do
game.Players.LocalPlayer.Leaderstats.Whatever.Value
there.