Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Tween is still not functioning, new fault this time. Now it doesn't even function?

I have explained this before, but i'm trying to make my menu thingy tween off-screen, and then make my button tween to 0.5x, which I got working, but it wasn't tweening this one part, so I wrote some new code, now it's not even moving, and it's just erroring. This is my code:

local Button = script.Parent
local GetMenu = Button.Parent.Parent.Parent
local Menu = GetMenu.MenuText
local Round = GetMenu.RoundHolder

function ButtonClick()
	for _, v in pairs(Menu, Round) do
		v:TweenPosition(UDim2.new(-1, 0, 0, 0))
	end
	
	local ButtonParent = Button.Parent.Parent
	ButtonParent:TweenPosition(UDim2.new(0, 0, 0.38, 0))
	Button.Text = ">"
end

Button.MouseButton1Click:Connect(ButtonClick)

The error I get when clicking on the button is: "Players.matiss112233.PlayerGui.ButtonsBar.CloseOpenButton.BackBackGround.TextButton.OpenClose:7: bad argument #1 (table expected, got Object)". I know this means I need a table, but I have no clue what type of table to make, please help me with this.

1 answer

✓ Accepted answer

Pairs doesn't take two variables, first off. It takes a table to iterate over. If you want to change every child inside of MenuText, use MenuText:GetChildren(). If you want to iterate over everything inside MenuText, use MenuText:GetDescendants().

1 comment

0

worked, im just confused with tables

This discussion is preserved as it was. New answers, comments, and votes are closed.