Advertisement
Guest User

Rebirth/Level system

a guest
Nov 19th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.06 KB | None | 0 0
  1. game.Players.LocalPlayer.CharacterAdded:wait()
  2. local rebirthinng = false
  3. script.Parent.Parent.Click.Frame.Frame2.Rebirth.MouseButton1Click:connect(function()
  4.     if rebirthinng == false then
  5.         local stats = game.Players.LocalPlayer:WaitForChild('All').Data
  6.         local rebirthneed = stats.Rebirth.Value*10+10
  7.         rebirthinng = true
  8.         repeat
  9.             wait(0.01)
  10.             if rebirthneed <= stats.Level.Value then
  11.                 stats.EXP.Value = 0
  12.                 stats.Rebirth.Value = stats.Rebirth.Value + 1
  13.                 stats.Level.Value = stats.Level.Value - rebirthneed
  14.             end
  15.         until rebirthneed > stats.Level.Value
  16.         rebirthinng = false
  17.     end
  18. end)
  19.  
  20. while wait(0.1) do
  21.     local stats = game.Players.LocalPlayer:WaitForChild('All').Data
  22.     local x = stats.Level.Value
  23.     local need = math.ceil((x^2)*(x^2/4)+20)
  24.     local crazypercent = stats.EXP.Value/need
  25.     local fixp1 = crazypercent*100
  26.     local textie2 = ''
  27.     local able2 = true
  28.     for i = 1, #tostring(fixp1) do
  29.         if able2 == true then
  30.             local check = string.sub(fixp1,i,i)
  31.             if check ~= '.' and able2 == true then
  32.                 textie2 = string.sub(tostring(fixp1),1,i)
  33.             else
  34.                 able2 = false
  35.             end
  36.         end
  37.     end
  38.     script.Parent.Parent.Click.Frame.Frame.RebirthLevelEXP.Text = 'Rebirth: '..stats.Rebirth.Value..'|Level: '..stats.Level.Value..'|XP: '..textie2..'%'
  39.     script.Parent.Parent.Click.Frame.Frame.RebirthLevelEXP.Frame.Size = UDim2.new(crazypercent,0,1,0)
  40.     local rebirthneed = stats.Rebirth.Value*10+10
  41.     local crazypercentage = stats.Level.Value/rebirthneed
  42.     local fixp2 = crazypercentage*100
  43.     local able = true
  44.     local textie = ''
  45.     for i = 1, #tostring(fixp2) do
  46.         if able == true then
  47.             local check = string.sub(fixp2,i,i)
  48.             if check ~= '.' and able == true then
  49.                 textie = string.sub(tostring(fixp2),1,i)
  50.             else
  51.                 able = false
  52.             end
  53.         end
  54.     end
  55.     script.Parent.Parent.Click.Frame.Frame2.Rebirth.Frame.Size = UDim2.new(crazypercentage,0,1,0)
  56.     script.Parent.Parent.Click.Frame.Frame2.Rebirth.Text = 'Rebirth: '..textie..'%'
  57.     if need <= stats.EXP.Value then
  58.         stats.Level.Value = stats.Level.Value + 1
  59.         stats.EXP.Value = stats.EXP.Value - need
  60.     end
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement