Chat commands with proximity chat

I want to make a proximity chat to where talking normally only people close to you can see it in chat, and if you are far away and type with a certain chat command everyone can see it.

I tried to make a string.sub chat command to change the Proximity Distance.

1 Like

I’m not too sure of what it is you’re asking, but I’m gonna assume you meant how do you made a proximity chat.
This other post & thread here has a code example and kinda explains it.
To sum it up, any time a message is sent, you check the magnitude of every non-sender player character in the server (either on server or client), and then you show to the message to all the players in the radius. (Or you can take the same approach that roblox’s whispering does and send it to every player but hide it on the ones it’s not meant for/out of range for)

1 Like

There is a hidden third parameter for command functions, priority. The default priority of a command function if not specified is 10. You could register your command function with priority 11 so that it will run before the proximity chat one does, assuming you’re using TheGamer101’s implementation.

local function command_func(fromSpeaker, message, channelName)
    -- Do something, then return a boolean determining if the Lua Chat
    -- should continue further running commands on the message or not.
    return false
end

ChatService:RegisterProcessCommandsFunction("foobar", command_func, 11)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.