I have tried and tried to make a script that takes all of the information from the leaderboard and puts it into to areas of a gui but it only shows the starter stats for the player when you increase the stats it does nothing for the gui
here is my code please fix it I have 3 scripts
exp displayer local EXP = game.Players.LocalPlayer.leaderstats.EXP.Value script.Parent.Text = "EXP: "..EXP
lv displayer local LV = game.Players.LocalPlayer.leaderstats.LV.Value script.Parent.Text = "LV: "..LV
exp local player = game.Players.LocalPlayer local leaderstats = player:WaitForChild('leaderstats') local level = player:WaitForChild('LV') local xp = player:WaitForChild('EXP')
level.Changed:connect(function() if xp.Value < 100level.Value then xp.Value = xp.Value - 100level.Value level.Value = level.Value + 1 end end)
it shows the base stats but if I change the leader stats the gui does not change please help
Lets say that for each leaderstats value, there is a textlabel in a gui
1 | lvl = game.Players.LocalPlayer.leaderstats.Level.Value |
2 |
3 | while true do |
4 | wait( 0.1 ) |
5 | script.Parent.Text = "Level " .. lvl |
1 | exp = game.Players.LocalPlayer.leaderstats.EXP.Value |
2 |
3 | while true do |
4 | wait( 0.1 ) |
5 | script.Parent.Text = exp .. " EXP" |
1 | local player = game.Player.LocalPlayer.leaderstats |
2 | expneeded = expneeded * player.Level.Value -- doubles the amount of xp needed everytime the player ranks up. |
3 |
4 | while true do |
5 | wait( 0.1 ) |
6 | if player.EXP.Value > = expneeded then |
7 | player.Level.Value = player.Level.Value + 1 --increases level |
8 | player.EXP.Value = 0 --resets exp value |
9 | expneeded = expneeded + 500 --increases the exp needed to rank up |
also if using game.Players.LocalPlayer you must put the code into a localscript or it will not work in a server/online game
you can make this one script if you just change script.Parent to the name of the textlabels. The last script can be put anywhere in the starterpack in a local script.