Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I disable messages with a "/" in them from showing?

I'm making admin commands and don't want them showing in chat, I have modified the "message sender" script but it doesn't work.

Edits on line 15 - 20

--	// FileName: MessageSender.lua
--	// Written by: Xsitsu
--	// Description: Module to centralize sending message functionality.

local module = {}
--////////////////////////////// Include
--//////////////////////////////////////
local modulesFolder = script.Parent

--////////////////////////////// Methods
--//////////////////////////////////////
local methods = {}
methods.__index = methods

function methods:SendMessage(message, toChannel)
	local prefix = "/"
	local splitString = message:split(prefix)
	if splitString[1] == prefix then
		else
	
	self.SayMessageRequest:FireServer(message, toChannel)
	end
end

function methods:RegisterSayMessageFunction(func)
	self.SayMessageRequest = func
end

--///////////////////////// Constructors
--//////////////////////////////////////

function module.new()
	local obj = setmetatable({}, methods)
	obj.SayMessageRequest = nil

	return obj
end

return module.new()

Thanks!

5 comments

0

nice OOP

0

what?

0

Nice object oriented programming. Lua isn't an object oriented programming language so Roblox gave us ModuleScripts to kind of fake it, and you're using a ModuleScript.

0

Ok, how can I fix my issue though

0

lol modules aren't oop or oop replacement modules are literally just containers that return any 1 value you can make them OOP tho, also roblox programming is less redundant when you use the OOP paradigm so it's a little more common sense.

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.