How can I name a function while using like an event

I dont know if I named this right but I’m trying to name a function thats being called by the onchatted event
so

game.Players.LocalPlayer.Chatted:Connect(function() <--I wanna name this function

Declare the function first before connecting the event to the function. Otherwise you’ll have an anonymous function.

so like

function blabla()
then
game.Players.LocalPlayer.Chatted:Connect(blabla()
?

1 Like

Yes, but here’s a more accurate and simplified way. This code does not necessarily work because it is simplified to the point to explaining the concept.

local function onChatted()
	-- code
end

LocalPlayer.Chatted:Connect(onChatted)