|
| 18 Sep 2014 06:00 AM |
This is my exp script (a free model exp bar gui):
local Player = script.Parent.Parent.Parent local XP = Player.XP local Level = Player.Level local bar = script.Parent.Display.BAR
GetExpNeeded = function(CurrLevel) local x = CurrLevel return 2*x^3 + 5*x^2 - 10*x + 34 end
GetTotalLevelXP = function(Level) local total = 0 for i = Level-1, 1, -1 do total = total + GetExpNeeded(i) end return total end
CalcExpPercent = function(CurrLevel, CurrXp) if (CurrLevel==1) then local ratio = CurrXp/GetExpNeeded(CurrLevel) return ratio>1 and 1 or ratio else local ratio = (CurrXp-GetTotalLevelXP(CurrLevel))/GetExpNeeded(CurrLevel) print(ratio,"=",(CurrXp-GetTotalLevelXP(CurrLevel)),":",GetExpNeeded(CurrLevel)) return ratio>1 and 1 or ratio end end
Level.Changed:connect(function() bar.Parent.Lvl.Text = "Level "..Level.Value for i = 1, 5 do bar.Parent.BorderColor3 = Color3.new(0,1,0) bar.Parent.Lvl.TextColor3 = Color3.new(0,1,0) wait(0.2) bar.Parent.BorderColor3 = Color3.new(0,0,1) bar.Parent.Lvl.TextColor3 = Color3.new(0,0,1) wait(0.2) end local xScale = CalcExpPercent(Level.Value, XP.Value) bar.Position = UDim2.new(-1+xScale, 2, 0, 2) bar.Parent.BorderColor3 = Color3.new(1, 204/255,0) bar.Parent.Lvl.TextColor3 = Color3.new(102/255,1,102/255) end)
XP.Changed:connect(function() local xScale = CalcExpPercent(Level.Value, XP.Value) bar.Position = UDim2.new(-1+xScale, 2, 0, 2) if (xScale==1) then Level.Value = Level.Value + 1 end end)
local scale = CalcExpPercent(Level.Value, XP.Value) bar.Position = UDim2.new(-1+scale, 2, 0, 2) bar.Parent.BorderColor3 = Color3.new(1, 204/255,0) bar.Parent.Lvl.TextColor3 = Color3.new(102/255,1,102/255) bar.Parent.Lvl.Text = "Level "..Level.Value
How do I make it so that exp is gained by a value ever 1 or so seconds?
Also how do I make it so collecting a orb will give the user exp? |
|
|
| Report Abuse |
|
KOzero
|
  |
| Joined: 11 May 2010 |
| Total Posts: 1411 |
|
| |
|
| 18 Sep 2014 07:18 AM |
| I will pay 50 Robux if anyone can help me? |
|
|
| Report Abuse |
|
|
| 18 Sep 2014 07:25 AM |
| People offer much more than that and still don't get help sometimes. We don't really make scripts for people. |
|
|
| Report Abuse |
|
|
| 18 Sep 2014 08:37 AM |
| Its not really making a script I just need to know how to increase exp value by 1 each second please help me? |
|
|
| Report Abuse |
|