Hello!
I am having some troubles with the script that’s in my text.
The script inside both of the text’s (first one being on the top where it shows 730/5500 and the second one being the same, but in the menu) works, but not to the extent I want it to. Basically, the value on the right (5500) is the required amount of XP for the player to level up and it changes once you leave and rejoin, but when you actually level up, the amount changes in the script, but it doesn’t show the change in the UI. For example, they need 5500 to level up, but once they level up their amount changes to 6000, but it still shows 5500.
Here’s the script:
Top image:
local player = game.Players.LocalPlayer
local levelStats = player:WaitForChild("LevelStats")
local level = levelStats:WaitForChild("Level")
local XP = levelStats:WaitForChild("XP")
local neededStr = (level.Value + 1) * 500
script.Parent.Text = ""..XP.Value.."/"..neededStr..""
local function update()
script.Parent.Text = ""..XP.Value.."/"..neededStr..""
end
XP.Changed:Connect(function()
update()
end)
level.Changed:Connect(function()
update()
end)
update()
Bottom Image:
local player = game.Players.LocalPlayer
-- values
local levelStats = player:WaitForChild("LevelStats")
local str = levelStats:WaitForChild("XP")
local level = levelStats:WaitForChild("Level")
local neededStr = (level.Value + 1) * 500
script.Parent.Text = "".. str.Value .."/".. neededStr ..""
level.Changed:Connect(function()
script.Parent.Text = "".. str.Value .."/".. neededStr ..""
end)
str.Changed:Connect(function()
script.Parent.Text = "".. str.Value .."/".. neededStr ..""
end)
Anything will help, feel free to ask questions! Thanks!