Cakey3101

Rebirth Server Script

May 1st, 2025
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | Source Code | 0 0
  1. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  2. local Players = game:GetService("Players")
  3.  
  4. local Remotes = ReplicatedStorage.Remotes
  5.  
  6. local function PlayerAdded(Player: Player)
  7.     local Leaderstats = Player:WaitForChild("leaderstats")
  8.     local LevelValue = Leaderstats:WaitForChild("Level")
  9.     local RebirthValue = Leaderstats:WaitForChild("Rebirth")
  10.     local XPValue = Player:WaitForChild("XP")
  11.    
  12.     local RequiredLevel = (RebirthValue.Value * 25) + 25
  13.    
  14.     RebirthValue.Changed:Connect(function()
  15.         RequiredLevel = (RebirthValue.Value * 25) + 25
  16.     end)
  17.    
  18.     if LevelValue.Value >= RequiredLevel then
  19.         Remotes.CanRebirth:FireClient(Player)
  20.     end
  21.    
  22.     LevelValue.Changed:Connect(function()
  23.         if LevelValue.Value >= RequiredLevel then
  24.             Remotes.CanRebirth:FireClient(Player)
  25.         end
  26.     end)
  27.    
  28.     Remotes.Rebirth.OnServerEvent:Connect(function()
  29.         if LevelValue.Value >= RequiredLevel then
  30.             RebirthValue.Value += 1
  31.             LevelValue.Value = 1
  32.             XPValue.Value = 0
  33.         end
  34.     end)
  35. end
  36.  
  37. Players.PlayerAdded:Connect(PlayerAdded)
Tags: robloxstudio
Advertisement
Add Comment
Please, Sign In to add comment