Guest User

Rebirth Buttons Server Script!

a guest
Jun 12th, 2024
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. -- remote handler script, replace current rebirth with this.
  2. -- make sure to adjust so it works with ur game.
  3.  
  4. -- Rebirth
  5. function Rebirth(Player, Amount) -- this will run the action when you passed all requirements for rebirthing
  6. Player.Data.PlayerData.Currency.Value = 0
  7. Player.Data.PlayerData.Rebirth.Value += Amount
  8.  
  9. local gemX = Multipliers.CurrencyMultiplier2(Player)
  10.  
  11. if gemX > 0 then -- gem calc
  12. Player.Data.PlayerData.Currency2.Value += 0.5 * Amount * Multipliers.CurrencyMultiplier2(Player)
  13. else
  14. Player.Data.PlayerData.Currency2.Value += 0.5 * Amount
  15. end
  16. end
  17.  
  18. Remotes.Rebirth.OnServerEvent:Connect(function(Player, Amount)
  19. if Cooldowns[Player.Name] == false then
  20. Cooldowns[Player.Name] = true
  21. if GameSettings.RebirthType.Value == "Linear" then
  22. if Player.Data.PlayerData.Currency.Value >= GameSettings.RebirthBasePrice.Value * Amount * (Player.Data.PlayerData.Rebirth.Value + 1) then
  23. Rebirth(Player, Amount)
  24. end
  25. else
  26. if Player.Data.PlayerData.Currency.Value >= GameSettings.RebirthBasePrice.Value * Amount * (GameSettings.RebirthMultiplier.Value + 1.25) ^ Player.Data.PlayerData.Rebirth.Value then
  27. Rebirth(Player, Amount)
  28. end
  29. end
  30. task.wait(0.08)
  31. Cooldowns[Player.Name] = false
  32. end
  33. end)
  34.  
  35. Remotes.RebirthButtonBuy.OnServerEvent:Connect(function(player, button, cost)
  36. if player and button and cost then
  37. if player.Data.PlayerData.Currency2.Value >= cost then
  38. player.Data.PlayerData.Currency2.Value -= cost
  39. player.Data.PlayerData.RebirthButton.Value = button
  40. end
  41. end
  42. end)
Advertisement
Add Comment
Please, Sign In to add comment