You cannot assign the Y on its own, you gotta add to a new Udim2 value
to the label's position, and that value will have X set to 0 so it doesn't effect the X axis for the label, but you can add more to the Y axis and that's by either adding scale or offset. And this is just a quick and this is jsut a little explanation.
Udim2.new = (x, x1, y, y2)
| x | is the X scale |
| x1 | is the X offset|
| y | is the Y scale |
| y1 | is the Y offset |
And of course if you wanna go deeper just search more!
Now instead of just changing the Y, do this:
local label = script.Parent.Parent.PlayerGui.bag_collected.bg
for p = .1,.15,.01 do
label.Position = Udim2.new(0,0,0,p)
wait()
end
and that's it. Another thing is you can make this way cooler and smoother, as Fearhen said you can use :TweenPosition. You can check the different styles and paramaters that you can use with this function here. I would just be showing how to change the position.
local label = script.Parent.Parent.PlayerGui.bag_collected.bg
label:TweenPosition(Udim2.new(0,0,0,.15)
An example.
3 comments
GUI's require U-Dimensional Size/Position assignments. Use UDim2.new() instead.
label.Position = label.Position + UDim2.new(0,0,0, 50)
Change 50 to the number you would like it to move by.
You should also be using TweenPosition as it'll create a smooth transition between your current and desired Position, with multiple styles too.