I need help on making an exp bar like the one similar to ROBLOX Deathrun. Is it possible to be assisted?
Here's the script:
01 | -- This is in a local script |
02 |
03 | local bar = script.Parent |
04 | local xpbar = bar.EXPBar |
05 | local overlay = xpbar.Overlay |
06 | local player = game.Players.LocalPlayer |
07 |
08 | if player:FindFirstChild( 'leaderstats' ) then |
09 | overlay:TweenSize(UDim 2. new(player.EXP.Value/player.EXP.Value, 0 , 1 , 1 , 0 )) |
10 | end |
01 | local player = game.Players.LocalPlayer |
02 | local bar = script.Parent |
03 | local xpbar = bar.EXPBar |
04 | local overlay = pbar.Overlay |
05 |
06 | player.EXP:Changed:connect( function (property) --This will check if the amount of EXP they have changed |
07 | if property = = "Value" then --This is checking if the property is value, value being the amount they have |
08 | local exp = player.EXP [ property ] --This will get the amount of EXP they have |
09 | local expMath = exp/(ExpValueNeededGoesHere) --If they have all the EXP needed (100/100 for example), expMath will equal 1, and take up the entire bar. If they're 50/100, it will equal .5 and take up half |
10 | overlay:TweenSize(UDim 2. new(expMath, 0 , 1 , 0 ) --Tween from its current position to the new one |
11 | end |
12 | end ) |
This SHOULD work. I can't really help as much, as I do not know where everything is.