I am currently working on a leveling system, and I've experienced problems, for some reason I cannot change the size of the experience bar, the experience bar is located within a frame.
This is what the directory looks like: https://i.gyazo.com/40dd0bbfe9420759edcde4f8affed3cc.png
This is what the GUI looks like: https://i.gyazo.com/ecbf5f49431cf6c38f732c517c0354e6.png
And this is what the script looks like:
-- X.Scale of greenColor widthOfXP = 0 while wait(0.01) do -- X.Scale Size changing size with an 0.01s interval game.StarterGui.ScreenGui.mainFrame.xpBar.greenColor.Size = UDim2.new(widthOfXP, 0, 0.8, 0) -- Adding 0.01 to widthOfXP widthOfXP = widthOfXP + 0.01 end
Does anyone have any idea how to fix this?
Temporary
Your code :
-- X.Scale of greenColor widthOfXP = 0 while wait(0.01) do -- X.Scale Size changing size with an 0.01s interval game.StarterGui.ScreenGui.mainFrame.xpBar.greenColor.Size = UDim2.new(widthOfXP, 0, 0.8, 0) -- Adding 0.01 to widthOfXP widthOfXP = widthOfXP + 0.01 end
Code fix :
Player = game.Players.LocalPlayer -- X.Scale of greenColor widthOfXP = 0 while wait(0.01) do -- X.Scale Size changing size with an 0.01s interval Player.PlayerGui.ScreenGui.mainFrame.xpBar.greenColor.Size = UDim2.new(widthOfXP, 0, 0.8, 0) -- Adding 0.01 to widthOfXP widthOfXP = widthOfXP + 0.01 end