Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is it possible to move a frame within a frame with a localscript?

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?

1 answer

✓ Accepted answer

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

2 comments

0

It's that simple? :o

0

;) i think xD

This discussion is preserved as it was. New answers, comments, and votes are closed.