Advertisement
PeaPattern

Main

Apr 17th, 2024
568
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.26 KB | None | 0 0
  1. local DSService = game:GetService("DataStoreService")
  2. local Codes = DSService:GetDataStore("CodesPlrs")
  3.  
  4. local RStorage = game:GetService("ReplicatedStorage")
  5. local Remotes = RStorage.Remotes
  6. local Modules = RStorage.Modules
  7.  
  8. Remotes.Click.OnServerEvent:Connect(function(Player)
  9.     local leaderstats = Player:WaitForChild("leaderstats")
  10.     local Clicks = leaderstats:WaitForChild("Clicks")
  11.     local Rebirths = leaderstats:WaitForChild("Rebirths")
  12.     Clicks.Value += Rebirths.Value + 1
  13. end)
  14.  
  15. Remotes.Rebirth.OnServerEvent:Connect(function(Player)
  16.     local leaderstats = Player:WaitForChild("leaderstats")
  17.     local Clicks = leaderstats:WaitForChild("Clicks")
  18.     local Rebirths = leaderstats:WaitForChild("Rebirths")
  19.     if Clicks.Value >= (Rebirths.Value + 1) * 100 then
  20.         Clicks.Value = 0
  21.         Rebirths.Value += 1
  22.     end
  23. end)
  24.  
  25. local CodeList = require(Modules.Codes)
  26.  
  27. Remotes.Code.OnServerInvoke = function(Player, TypedCode)
  28.     local Data = Codes:GetAsync(Player.UserId)
  29.     if not Data then return 1 end
  30.    
  31.     local Found = Data[TypedCode]
  32.     if Found then
  33.         for code, callback in CodeList do
  34.             if code == TypedCode:lower() then
  35.                 callback(Player)
  36.                 Data[code] = false
  37.                 Codes:SetAsync(Player.UserId, Data)
  38.                 return 2
  39.             end
  40.         end
  41.     else
  42.         return 1
  43.     end
  44.    
  45.     return 0
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement