Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 9 years ago

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

Log in to vote
3
Answered by 9 years ago

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
0
It's that simple? :o Hyperclux 65 — 9y
0
;) i think xD ScripterGame 145 — 9y
Ad

Answer this question