I keep getting this error and im not really sure what it means, can someone help me?
local player = game.Players.LocalPlayer
local CurrentExp = player:WaitForChild("leaderstats").Exp.Value
local MaxExp = player:WaitForChild("leaderstats").ExpToLevel.Value
local Gui = script.Parent
local Exterior = Gui:WaitForChild("BackFrame")
local label = Gui:WaitForChild("TextLabel")
local Bar = Gui:WaitForChild("Expbar")
CurrentExp.Changed:Connect(function() --This is where the problem is
if CurrentExp >= MaxExp then
Bar.Size = UDim2.new(CurrentExp/MaxExp,0,1,0)
wait(0.5)
CurrentExp = 0
Bar.Size = UDim2.new(CurrentExp/MaxExp,0,1,0)
else
Bar.Size = UDim2.new(CurrentExp/MaxExp,0,1,0)
end
end)
Bar.Size = UDim2.new(CurrentExp/MaxExp,0,1,0)
Everytime there is CurrentExp, change it toCurrentExp.Value except for the one with .changed, so soemthing like
local player = game.Players.LocalPlayer
local CurrentExp = player:WaitForChild("leaderstats").Exp
local MaxExp = player:WaitForChild("leaderstats").ExpToLevel
local Gui = script.Parent
local Exterior = Gui:WaitForChild("BackFrame")
local label = Gui:WaitForChild("TextLabel")
local Bar = Gui:WaitForChild("Expbar")
CurrentExp.Changed:Connect(function()
if CurrentExp.Value >= MaxExp.Value then
Bar.Size = UDim2.new(CurrentExp.Value/MaxExp.Value,0,1,0)
wait(0.5)
CurrentExp.Value = 0
Bar.Size = UDim2.new(CurrentExp.Value/MaxExp.Value,0,1,0)
else
Bar.Size = UDim2.new(CurrentExp.Value/MaxExp.Value,0,1,0)
end
end)
Bar.Size = UDim2.new(CurrentExp.Value/MaxExp.Value,0,1,0)
Anytime! I recommend you mark my post as the solution incase anyone stumbles upon this post and needs a solution too! IF you have anymore questions don’t be afraid to ask!