Attempt to connect failed: Passed value is not a function?

I have this error and i have no idea how to fix it:

local Printer = function(Name)
	print(Name)
end

game.Players.LocalPlayer.CharacterAdded:Connect(Printer(game.Players.LocalPlayer.Name))

The script uses the function created at the beginning of the code in the event
What is the issue?

14 Likes

You used :Connect wrong. If you want to execute a function with custom parameters, make a function.

function Printer(Name)
	print(Name)
end

game.Players.LocalPlayer.CharacterAdded:Connect(function()
 Printer(game.Players.LocalPlayer.Name)
end)

EDIT: Fixed my mistake in function

58 Likes