Hey, so I’m using Jumpathy’s BetterChat V3 (Check it out!), and I can’t figure out an error that’s going on with a custom command I’m trying to make.
I’ve tried asking in BC3’s DevForum post (which is pretty much dead as no one’s talking there anymore and the creator’s taking a break from Roblox according to their Roblox profile’s About Me section) and looked at the docs several times but there’s no mention of this issue and no possible way for me to figure out what’s causing it.
Here’s the link to BC3’s main module in case it’s needed:
create.roblox.com/marketplace/asset/9375790695
This is my code which is essentially the same as the one provided in the API documentation;
And this is the error:
This is the speaker module required from the API:
Speaker Module
return function(network,fetch,signal)
local speakerModule = {}
speakerModule.internal = {}
speakerModule.internal.speakers = {}
speakerModule.speakerAdded = signal.new()
speakerModule.speakerRemoved = signal.new()
local speakersList = speakerModule.internal.speakers
local channel
function speakerModule.new(name,player)
if(speakersList[name] ~= nil) then
warn(("[Better Chat]: Speaker '%s' already exists."):format(name))
return false
end
local speaker = {}
speaker.name = name
speaker.channels = {}
speaker.tags = {}
speaker.isPlayer = (player ~= nil)
speaker.id = (speaker.isPlayer and player.UserId or nil)
speaker.player = player
speaker.muted = false
speaker.icon = ""
speaker.events = {
channelUpdated = signal.new(),
muteUpdate = signal.new(),
chatted = signal.new()
}
if(player) then
speaker.events.channelUpdated:Connect(function()
network:fireClients("receiveChannelUpdate",{player},fetch(speaker))
end)
speaker.events.muteUpdate:Connect(function()
network:fireClients("receiveMuteUpdate",{player},speaker.muted)
end)
end
function speaker:unmute()
speaker.muted = false
speaker.events.muteUpdate:Fire(false)
end
function speaker:mute()
speaker.muted = true
speaker.events.muteUpdate:Fire(true)
end
function speaker:addTag(text,color)
table.insert(speaker.tags,{
text=text,
color=color
})
end
function speaker:updateMuteStatus(state)
speaker.muted = state
speaker.events.muteUpdate:Fire(state)
end
function speaker:removeTag(text)
for key,tag in pairs(speaker.tags) do
if (tag.text == text) then
table.remove(speaker.tags,key)
end
end
end
function speaker:addToChannel(channelName)
channel:getByName(channelName):addSpeaker(speaker)
end
function speaker:removeFromChannel(channelName)
channel:getByName(channelName):removeSpeaker(speaker)
end
function speaker:setIcon(icon)
speaker.icon = icon
end
function speaker:say(channelName,message,existing)
local toSendIn = channel:getByName(channelName)
if(not toSendIn:canSpeakerTalk(speaker)) then
warn(("%s cannot talk in channel '%s'"):format(speaker.name,channelName))
return
end
local object = toSendIn:sendMessage(speaker,message,existing)
speaker.events.chatted:Fire(message,object)
return object
end
function speaker:Destroy()
for _,channel in pairs(speaker.channels) do
pcall(function()
channel:removeSpeaker(speaker)
end)
end
for _,event in pairs(speaker.events) do
event:DisconnectAll()
end
speakersList[name] = nil
speakerModule.speakerRemoved:Fire(name)
end
speakersList[name] = speaker
channel:findAutojoinForSpeaker(speaker)
speakerModule.speakerAdded:Fire(speaker)
return true,speaker
end
function speakerModule:getByName(name)
return speakersList[name]
end
function speakerModule:getById(id)
for _,speaker in pairs(speakersList) do
if(speaker.id == id) then
return speaker
end
end
end
function speakerModule:getSpeakers()
return speakersList
end
function speakerModule:setup(module)
channel = module
end
return speakerModule
end
and this is where the module’s located.
Any help is appreciated!