How would I change my script from a loop so that it only updates when the value of a player's XP changes?
Exp = script.Parent.Parent.Parent.Parent.Parent.LevelSystem.XP
Level = script.Parent.Parent.Parent.Parent.Parent.LevelSystem.Level
while true do
wait(0.5)
local pie = ( Exp.Value / (Level.Value * 200 + 1))
script.Parent.Size = UDim2.new( pie , 0 , 1 , 0)
end

2 comments
i think it does't work with values, but i dunno im new, kinda
1 local Exp = script.Parent.Parent.Parent.Parent.Parent.LevelSystem.XP 2 local Level = script.Parent.Parent.Parent.Parent.Parent.LevelSystem.Level 3 4 5 Exp.Changed:Connect(function() 6 local pie = ( Exp.Value / (Level.Value * 200 + 1)) 7 script.Parent.Size = UDim2.new( pie , 0 , 1 , 0) 8 end)