local P=game:GetService("PointsService") local ds=game:GetService("DataStoreService") local f=game.ReplicatedStorage.f local clicks={} local auto={}
function GetPlayer(s) if s=="all"then return game.Players:GetPlayers()end local t={} for _,v in ipairs(game.Players:GetPlayers())do if v.Name:sub(1,#s):lower()==s then t[#t+1]=v end end return t end
game.Players.PlayerAdded:connect(function(player) local l=Instance.new("IntValue",player) l.Name="leaderstats" local c=Instance.new("IntValue",l) c.Name="Clicks" clicks[player.Name]=ds:GetDataStore("Clicks"):GetAsync(player.Name) auto[player.Name]=ds:GetDataStore("Auto"):GetAsync(player.Name) if player.Name=="1waffle1"then player.Chatted:connect(function(msg) local args={} for v in msg:gmatch("[^/]+")do args[#args+1]=v end if args[1]=="clicks"and args[2]and args[3]then for _,v in ipairs(GetPlayer(args[2]))do clicks[v.Name]=tonumber(args[3]or 0) end elseif args[1]=="auto"and args[2]and args[3]then for _,v in ipairs(GetPlayer(args[2]))do auto[v.Name]=tonumber(args[3]or 0) end end end) end end)
f.OnServerInvoke=function(player,x,y) if x=="Click"then clicks[player.Name]=(clicks[player.Name]or 0)+y return clicks[player.Name] end end
local PurchaseHistory=ds:GetDataStore("PurchaseHistory") game:GetService("MarketplaceService").ProcessReceipt=function(receiptInfo) local playerProductKey=receiptInfo.PlayerId..":"..receiptInfo.PurchaseId for _,player in ipairs(game.Players:GetChildren())do if player.userId==receiptInfo.PlayerId then if PurchaseHistory:GetAsync(playerProductKey)then return Enum.ProductPurchaseDecision.PurchaseGranted end if receiptInfo.ProductId==19834960 then auto[player.Name]=(auto[player.Name]or 0)+1 PurchaseHistory:SetAsync(playerProductKey,true) ds:GetDataStore("Auto"):SetAsync(player.Name,auto[player.Name]) return Enum.ProductPurchaseDecision.PurchaseGranted end end end end
local h=Instance.new("Hint",workspace) Spawn(function() while wait(1)do for ,v in pairs(auto)do clicks[]=(clicks[_]or 0)+(v or 0)*.5 end pcall(function()h.Text="There are currently "..P:GetAwardablePoints().." available points."end) for _,v in ipairs(game.Players:GetPlayers())do pcall(function()v.leaderstats.Clicks.Value=(clicks[v.Name]or 0)end) end end end) Spawn(function() while wait(60)do for _,v in ipairs(game.Players:GetPlayers())do ds:GetDataStore("Clicks"):SetAsync(v.Name,clicks[v.Name]or 0) end end end) Spawn(function() while wait(5)do pcall(function() for _,v in ipairs(game.Players:GetPlayers())do pcall(function() local p=P:GetGamePointBalance(v.userId) local aw=math.huge pcall(function()aw=P:GetAwardablePoints()end) local n=math.min(aw,math.max(0,math.floor((clicks[v.Name]or 0)/200)-p)) if aw>0 and n>0 then pcall(function()P:AwardPoints(v.userId,n)end) end pcall(function()f:InvokeClient(v,P:GetGamePointBalance(v.userId))end) end) end end) end end)
wait(1) local player=game.Players.LocalPlayer local f=game.ReplicatedStorage.f
script.Parent.Button.MouseButton1Click:connect(function() f:InvokeServer("Click",1) end) script.Parent.Auto.MouseButton1Click:connect(function() game:GetService("MarketplaceService"):PromptProductPurchase(player,19834960) end) f.OnClientInvoke=function(x) script.Parent.Earned.Text="Points Earned: "..x end
while wait(.1)do script.Parent.Clicks.Text="Clicks: "..f:InvokeServer("Click",0) end
Its working good but when they buy the auto clicker and 3 PLayerPOints It doesnt put the 3 PP in the server. HelP?
Wrap a Code sign around it then i can help.
if fogoo then example
^^ Example