Attempt to connect failed: Passed value is not a function

Local:

wait(0.3)

local gui = script.Parent.Parent.MainButtons
local dailyButton = gui.dailyButton
local wheelButton = gui.spinButton
local presentButton = gui.presentsButton
local autoFight = gui.autoPunchButton

local tween = game:GetService("TweenService")

local function button_animation(button)
	local normalX = button.Size.X.Scale
	local noramlY = button.Size.Y.Scale

	local enterX = normalX + 0.007
	local enterY = noramlY + 0.007

	local pressX = normalX - 0.025
	local pressY = noramlY - 0.005

	button.MouseEnter:Connect(function()
		button:TweenSize(UDim2.new(enterX,0,enterY,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)
	end)

	button.MouseLeave:Connect(function()
		button:TweenSize(UDim2.new(normalX,0,noramlY,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)
	end)
end

dailyButton.MouseEnter:Connect(button_animation(dailyButton))

So here I have a function for button animation, I want to be able to use this function for each button. It seems to work, but for some reason, I get this error: Attempt to connect failed: Passed value is not a function

how do I fix it?

This is not how u make Tween

Okay, I’ll fix it, but does it affect the bug I have?

It should fix it if u make it correct

When you’re connecting to the MouseEnter event on the last line you’re calling the button_animation function instead of giving it a function, so you need to give it a function which calls the button_animation function:

local function onMouseEnter()
	button_animation(dailyButton)
end

dailyButton.MouseEnter:Connect(onMouseEnter)

:TweenSize() is a valid method to tween objects