Hey, guys so I posted a question about this not too long ago someone answered it and help me out thank God but, now I ran into another problem... I fixed my code and all however, in-game the same value error keeps popping up.... Here are the script and Error and yes this game uses FIlteringEnabled my script is inside of a ImageLabel and it's a LocalScript and it's activated by a RemoteEvent.
ERROR:
08:18:44 - Players.KingLoneCat.PlayerGui.StatsGui.XP Gui.ImageLabel.LocalScript:7: attempt to call field 'Value' (a number value)
08:18:44 - Stack Begin 00:19:48.961 - Script 'Players.KingLoneCat.PlayerGui.StatsGui.XP Gui.ImageLabel.LocalScript', Line 7
08:18:44 - Stack End
SCRIPT:
local player = script.Parent.Parent.Parent.Parent.Parent
local stats = player:WaitForChild("Stats")
local xp = stats:WaitForChild("XP")
local level = stats:WaitForChild("Level")
local defense = stats:WaitForChild("Defense")
local tlabel = script.Parent.Parent:WaitForChild("TextLabel")
tlabel.Text = "XP: "..xp.Value.."/"..xp.MaxValue
xp.Changed:connect(function()
if xp.Value >= xp.MaxValue and level.Value ~= 15 then
level.Value = level.Value + 1
defense.Value = defense.Value + 10
xp.MaxValue = xp.MaxValue + 20
xp.Value = 0
tlabel.Text = "XP: "..xp.Value.."/"..xp.MaxValue
else
tlabel.Text = "XP: "..xp.Value.."/"..xp.MaxValue
script.Parent:TweenSize(UDim2.new(xp.Value/xp.MaxValue,0,.05,0), "InOut", "Quad", .2, true)
end
end)
Thank you for reading this question and I hope someone can help!
~~ KingLoneCat

2 comments
what is object xp and how can is sore both both xp.Value and xp.MaxValue?
XP is an IntConstrainedValue