Advertisement
Guest User

Remotes

a guest
Oct 20th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.08 KB | None | 0 0
  1. local replicatedStorage = game:GetService("ReplicatedStorage")
  2. local remoteData = game:GetService("ServerStorage"):WaitForChild("RemoteData")
  3. local starterRebirthAmount = 1000000
  4.  
  5. local cooldown = 1
  6.  
  7. local mapmulti = game.ReplicatedStorage.mapmultiplier.Value
  8.  
  9.  
  10. replicatedStorage.Remotes.Lifty.OnServerEvent:Connect(function(player, added)
  11.     if not remoteData:FindFirstChild(player.Name) then return "NoFolder" end
  12.    
  13.     local debounce = remoteData[player.Name].Debounce
  14.    
  15.     if not debounce.Value and (player.leaderstats.Radiation.Value + added * mapmulti * (player.leaderstats.Rebirths.Value + 1)) >= player.BackpackShop.BackpackV.Value then
  16.         debounce.Value = true
  17.        
  18.         player.leaderstats.Radiation.Value = player.BackpackShop.BackpackV.Value       
  19.         wait(cooldown)
  20.        
  21.         debounce.Value = false
  22.     else if not debounce.Value and  (player.leaderstats.Radiation.Value + added * mapmulti * (player.leaderstats.Rebirths.Value + 1)) <= player.BackpackShop.BackpackV.Value then
  23.         debounce.Value = true
  24.         --print'mother god'
  25.         --if (player.leaderstats.Radiation.Value + moneyadded * mapmulti * (player.leaderstats.Rebirths.Value + 1)) >= player.
  26.         player.leaderstats.Radiation.Value = player.leaderstats.Radiation.Value + added * mapmulti * (player.leaderstats.Rebirths.Value + 1)
  27.        
  28.         wait(cooldown)
  29.        
  30.         debounce.Value = false
  31.         end
  32.     end
  33. end)
  34.  
  35.  
  36. replicatedStorage.Remotes.Rebirth.OnServerInvoke = function(player)
  37.    
  38.     if not remoteData:FindFirstChild(player.Name) then return "NoFolder" end
  39.    
  40.     local rebirths = player.leaderstats.Rebirths
  41.    
  42.     if player.leaderstats.Energy.Value >= (math.floor((starterRebirthAmount + (rebirths.Value) * math.sqrt(100000000)))) then
  43.        
  44.         rebirths.Value = rebirths.Value + 1
  45.        
  46.         player.leaderstats.Energy.Value = 0
  47.        
  48.         player.leaderstats.Radiation.Value = 0
  49.        
  50.         player:WaitForChild("BackpackShop").Equipped.Value = "Starter Pack"
  51.        
  52.         player:WaitForChild("ToolShop").Equipped.Value = "Starter Star"
  53.        
  54.         player:WaitForChild("BackpackShop").BackpackV.Value = 10
  55.        
  56.         player:LoadCharacter()
  57.        
  58.         return true
  59.     else return "NotEnoughEnergy"
  60.     end
  61.    
  62. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement