for p = .1,.15,.01 do script.Parent.Parent.PlayerGui.bag_collected.bg.Position.Y = Vector2.new(p,0) wait() end
and it says Y cant be assigned to, i dont know how to fix this, its probably simple, but i cant figure it out, please help. Thanks :)
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 --I also assigned a variable that refers to your label just to make stuff easier. 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) --as you can see were using a udim2 value here too. this is just an example, play with the numbers however you want to!