So I made an image Button and whenever you click it a menu is supposed to pop up but I am getting an error saying (argument 2 missing or nill)
Here is my code
local menuButton = script.Parent local mainMenu = script.Parent.Parent.MenuFrame.mainMenuFrame local Tween = game:GetService("TweenService") menuButton.MouseButton1Up:Connect(function() mainMenu:TweenSizeAndPosition{ UDim2.new(0, 479,0, 271), UDim2.new(-7.792, 0,-0.742, 0), Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 1, false } end)
Please tell me what I missed or what i'm doing wrong.
So basically I had easing direction and easing style the wrong way around.
Easing Direction comes first then Easing style comes second.
I had Easing Style first and Easing Direction Second that's why it wasn't working, this is how it is supposed to look.
local menuButton = script.Parent local mainMenu = script.Parent.Parent.MenuFrame.mainMenuFrame local Tween = game:GetService("TweenService") menuButton.MouseButton1Up:Connect(function() mainMenu:TweenSizeAndPosition{ UDim2.new(0, 479,0, 271), UDim2.new(-7.792, 0,-0.742, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 1, false } end)
So, first off, just like Killerbrenden said in his comment, you need to make the brackets parentheses. It's in a tween function, not a table, you're listing the information that the tween needs in order to fire, it's not a table. This is also why you got a different error when you changed them.
Now, for second error, all you need to do is switch the EasingStyle and EasingDirection. In TweenSizeAndPosition, EasingDirection comes first. I changed your code, and this is what it's like with the changes:
local menuButton = script.Parent local mainMenu = script.Parent.Frame local Tween = game:GetService("TweenService") menuButton.MouseButton1Up:Connect(function() mainMenu:TweenSizeAndPosition( UDim2.new(0, 479,0, 271), UDim2.new(-7.792, 0,-0.742, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 1, false ) end)
Also, when I tested it, it made the frame go off screen, so you'll need to change where it moves to. It could just be my screen, but I'm not entirely sure.