How to Make a XP Bar

Posted on

For those whoa re looking for the method of how to make the XP bar, you are in the right place as you will be informed about it. Please read everything well and do not miss a single thing even just a word.

In order to make the XP bar, here are all the steps that you have to do. First, insert the script inside the workspace. The screen you are about to make is the leaderboard for level and exp. The script for this will be in the desc but it is better if you follow along and understand what is happening

1. game.Players,PlayersAdded=connect (function (Player)

2. local Leaderstats = Instance.new(“IntValue”, Player)

3. Leaderstats.Name = “Leaderstats”

4. local Level = Instance.new(“IntValue”, Leaderstats)

5. Level.Name = “Level”

6. Level.Value = 1

7. Local Exp = Instance.new(“IntValue”, Leaderstats)

8. Exp.Name = “Exp”

9. Exp.Value = 0

10.

11. Exp.Changed.connect (function) ExpChange (Player.Exp.Level) and)

12.

13. And)

14.

15. Function ExpChange (Player.Exp.Level)

16. If Exp.Value >= Level.Value*200 then

17. Exp.Value = 0

18. Level.Value = Level.Value + 1

19. end

20. end

You can change *200 to what you want the exp to be so players can level up. Aside from that, you are also able to change +1 to whatever you want the level of the player to be once they level up. For instance: Level 1 + 1 = Level 2.


Second, go to Starter GUI and insert the Screen GUI. You can rename it to the exp if you like. Third, insert the frame inside of the Screen GUI. Please change the size to (0,1), (0,20) and the position to (0,0), (1,30). Fourth, insert another frame inside the Screen GUI. You have to change the size to (0.1), (0,20). Fifth, insert the script inside of the second frame:

1. Exp = script.Parent.Parent.Parent.Parent.Leaderstate.Exp

2. Level = script.Parent.Parent.Parent.Parent.Leaderstate.Level

3.

4. while true do

5. wait ()

6. local pie = ( Exp. Value / (Level.Value *200 + 1) )

7. script.Parent.Size = Udim2.new pie, 0, 0, 20)

8. end

Please keep in mind that this script is just to display the amount of exp needed to level up and the current exp players have. Sixth, go back to the first frame and this time insert the text label. Seventh, change the size to (0,1), (0,20). Eighth, change the font to whatever you like. Also, you can turn on the text scaled and make sure the text is blank. Ninth, insert the script inside the text label. This one will change the exp value once you level up. Tenth, insert the Screen GUI. Eleventh, rename it to the level if you like. Twelfth, insert the text label inside the second Screen GUI. Thirteenth, change the position to (0,10), (0,400). Fourteenth, insert the script inside the text label. Fifteenth, go back to the text label properties. Sixteenth, change the background to 1 and text to level. Aside from that, you can also turn on the text scaled. Everything has to be done.

Leave a Reply

Your email address will not be published. Required fields are marked *