Hello everyone, so I'm doing a thing with a GUI and I want to create a cool effect that moves a bunch of buttons inside a folder to the left each other, but the value always comes {0,0,0,0}
Here's the script:
for i,v in pairs (script.Parent.Parent:GetChildren()) do local Position = UDim2.new(v.Position + UDim2.new(-0.7,0,0,0))--I tried with - and * and didn't work v:TweenPosition(UDim2.new(Position),"Out","Quad",1) print(Position)--Prints {0,0},{0,0} print(v.Position) --+Prints high numbers such as {0.0599999987, 0}, {0.649999976, 0} for some reason, shouldn't even be posible. wait(.3) end
Huge thanks to whoever helps me!
This is because the UDim2.new
constructor expects 2 or 4 arguments, while you're just providing one, which will make it return "{0,0}, {0,0}".
To fix your script, you just have to remove the UDim2.new
in the beginning, so it should look like this now:
for i,v in pairs (script.Parent.Parent:GetChildren()) do -- Fixing the position local Position = (v.Position + UDim2.new(-0.7,0,0,0)) -- Tweening the button v:TweenPosition(Position, "Out", "Quad", 1); -- Waiting :o wait(.3) end