I’m trying to stop a message from being sent if a specific condition is met but it isn’t working. My print statements do log properly but nothing happens to the message.
local player = game.Players:GetPlayerByUserId(message.SpeakerUserId)
local trasmitting = player.PlayerGui.Police.Radio.CheckTransmitting:InvokeClient(player)
if player.Team.Name == 'PD' and trasmitting then
message.ShouldDeliver = false
I’m not sure, but there may be some timeout on the callback in case nothing is returned and the game wants the chat to be sent fast. Try setting transmitting to true automatically and removing the InvokeClient to see if it works.
I believe having the client send a value to the server every time they start/end transmitting and the server storing that value somewhere inside the player will work as it won’t have any delays getting it.