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

12:50:55.227 - Attempt to connect failed: Passed value is not a function?

LINES 183-187

for x,y in pairs(script.Parent:GetChildren()) do
	if not(y:IsA("Script")) then
		y.Action.MouseButton1Click:Connect(action(y))
	end
end

I don't know what is wrong, but i need it to still input the thing that was clicked into the function. Help is really appreciated, since this is one error in a 200 line script i have to fix!

1 comment

0

"action" isn't a function, according to the error message. Can you show us which line you defined it on?

1 answer

✓ Accepted answer

The parameter of Connect is a callback function. What you are doing is calling a function that's returning anything besides a function. A quick fix to your problem would be to create a new function as a parameter inside of Connect that calls your action function.

y.Action.MouseButton1Click:Connect(function()
	action(y)
end)

1 comment

0

thx

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