Player.Chatted is not firing

Hello, the Chatted event is not firing or giving me any errors, I don’t see why?

game.Players.PlayerAdded:Connect(function(p)
    p.Chatted:Connect(function(c,recip)
        cEvent:FireAllClients(p,c)
        print("chat event fired")

This is the part of the script that is not doing anything. ^^

You didn’t reference the cEvent.

Oh yes I have, that’s a small portion of a 500 line script.

Can I see the whole script please.

The whole script works, trust me I am an advanced scripter I know how things work, the only part which does not work is the chatted function.

Does “chat event fired” print? When you chat something?

Nope, nothing prints. (Darn character limit)

Then the problem has to be something else in your script

1 Like

i would say open a new empty place and try this there if it works there, then there is something in the rest of the script.

I think I know. If an event (in this case your event) is under a loop, while true, or repeat. It completely breaks and does not run. Instead try putting your event near the top of your script, above and loops.

I would assume the PlayerAdded event didn’t fire in time.
Please double check if that fires, if not, here’s a quick fix for you.

local Players = game:GetService('Players')


local function PlayerAdded(Player)
	print(('%s joined.'):format(Player.Name))
	local function Chatted(Message) -- Player.Chatted only has one parameter, not two.
		print(('%s said %s.'):format(Player.Name, Message))
	end
	Player.Chatted:Connect(Chatted)
end


local GetPlayers = Players:GetPlayers()
for i = 1, (#GetPlayers)
do
	task.spawn(PlayerAdded, GetPlayers[i])
end
Players.PlayerAdded:Connect(PlayerAdded)

If you don’t provide the whole script to this code, we’ll likely not be able to solve your issue. It may seem like you don’t need to do this, but the more code showed the more we’ll be able to determine what the problem is.

Alright I will look into @Xacima’s suggestion, thanks.