generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: exp level up script help?

Previous Thread :: Next Thread 
OriginalNexus is not online. OriginalNexus
Joined: 27 Oct 2008
Total Posts: 242
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 is not online. KOzero
Joined: 11 May 2010
Total Posts: 1411
18 Sep 2014 07:07 AM
lrn2lua b4 du tis.
Report Abuse
OriginalNexus is not online. OriginalNexus
Joined: 27 Oct 2008
Total Posts: 242
18 Sep 2014 07:18 AM
I will pay 50 Robux if anyone can help me?
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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
OriginalNexus is not online. OriginalNexus
Joined: 27 Oct 2008
Total Posts: 242
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image