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

Why Wont This Custom Chat Send The Message?

Why Wont This Custom Chat Send The Message? I Believe It May Have Something To Do With The Filtering Being Done On Client Side? Is That Bad? But There Was No Errors Too

code here:

game:GetService('UserInputService').InputBegan:connect(function(key)
	if key.KeyCode == Enum.KeyCode.Slash then
		if Focused ~= true then
		script.Parent.ChatBar:CaptureFocus()
		Focused = true
		repeat
			wait(.1)
			script.Parent.ChatBar.Text = ""
		until script.Parent.ChatBar.Text == ""
		end
	end
end)

script.Parent.ChatBar.FocusLost:connect(function(enter) -- this is what sends and filters the code
	if enter == true then
		Focused = false
		local Msg = script.Parent.ChatBar.Text
		local LoweredMsg = string.lower(script.Parent.ChatBar.Text)
		
		local FilteredMessage = game.Chat:FilterStringForBroadcast(Msg, game.Players.LocalPlayer)
		local count = 0
		repeat
			wait(.1)
			for index,value in ipairs(BlockedWords) do
				local NewFilter string.find(string.lower(FilteredMessage), value)
				
				if NewFilter ~= nil then
					Msg = string.gsub(Msg, value, "*")
					wait(.1)
					Msg = string.gsub(Msg, "#", "*")
				end
			end
		until count == 200
		game:GetService('Lighting').ChatFunctions.PublicChat:Invoke(Msg, game:GetService('Players').LocalPlayer)
	end
end)

game:GetService('Lighting').ChatFunctions.PublicChat.OnInvoke:connect(function(msg,plr)
	if Chatcount == 0 then
		local msgclone = game:GetService('Lighting').ChatMsg:Clone()
		if plr == "TheGrimDeathZombie" then
			local rainbow = game:GetService('Lighting').RainbowText:Clone()
			rainbow.Parent = msgclone
			msgclone.Text = "[Founder]"..msg
		elseif plr == "SamgladiatorRB" then
			local rainbow = game:GetService('Lighting').RainbowText:Clone()
			rainbow.Parent = msgclone
			msgclone.Text = "[Youtuber]"..msg
		elseif plr == "DrKaiBlox123" then
			local rainbow = game:GetService('Lighting').RainbowText:Clone()
			rainbow.Parent = msgclone
			msgclone.Text = "[Co-Founder]"..msg
		elseif plr == "Player1" then
			local rainbow = game:GetService('Lighting').RainbowText:Clone()
			rainbow.Parent = msgclone
			msgclone.Text = "[Founder]"..msg
		end
	end
end)

2 comments

0

You should have an appropriate description that properly addresses your question.

0

ok, i'll make one now then

1 answer

✓ Accepted answer

You forgot an = on line 25. Check your output for errors next time before posting stuff here.

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