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

EDIT: I Figured It Out but it only works in studio

client-side code here:

Chatcount = 0
Maxchats = 10
CanvasSizea = 1
Focused = false

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)
	if enter == true then
		Focused = false
		local Msg = script.Parent.ChatBar.Text
		print(Msg)
		game:GetService('ReplicatedStorage').ChatFunctions.FilterChat:InvokeServer(game:GetService('Players').LocalPlayer, Msg)
		script.Parent.ChatBar.Text = ""
	end
end)

game:GetService('ReplicatedStorage').ChatFunctions.PublicChat.OnInvoke = function(plr, msg)
	if Chatcount == 0 then
		msgclone = game:GetService('ReplicatedStorage').ChatMsg:Clone()
		msgclone.Parent = script.Parent.ChatWindow.ScrollingFrame
		Chatcount = Chatcount + 0.08
		if plr == "TheGrimDeathZombie" then
			local rainbow = game:GetService('ReplicatedStorage').RainbowText:Clone()
			rainbow.Parent = msgclone
			msgclone.Text = "[Founder]"..msg
		elseif plr == "SamgladiatorRB" then
			local rainbow = game:GetService('ReplicatedStorage').RainbowText:Clone()
			rainbow.Parent = msgclone
			msgclone.Text = "[Youtuber]"..msg
		elseif plr == "DrKaiBlox123" then
			local rainbow = game:GetService('ReplicatedStorage').RainbowText:Clone()
			rainbow.Parent = msgclone
			msgclone.Text = "[Co-Founder]"..msg
		elseif plr == "Player1" then
			local rainbow = game:GetService('ReplicatedStorage').RainbowText:Clone()
			rainbow.Parent = msgclone
			msgclone.Text = "[Founder]"..msg
		end
	else
		msgclone = game:GetService('ReplicatedStorage').ChatMsg:Clone()
		msgclone.Parent = script.Parent.ChatWindow.ScrollingFrame
		msgclone.Position = UDim2.new(0, 0, Chatcount, 0)
		wait(.1)
		Chatcount = Chatcount + 0.08
		if plr == "TheGrimDeathZombie" then
			local rainbow = game:GetService('ReplicatedStorage').RainbowText:Clone()
			rainbow.Parent = msgclone
			msgclone.Text = "[Founder]"..msg
		elseif plr == "SamgladiatorRB" then
			local rainbow = game:GetService('ReplicatedStorage').RainbowText:Clone()
			rainbow.Parent = msgclone
			msgclone.Text = "[Youtuber]"..msg
		elseif plr == "DrKaiBlox123" then
			local rainbow = game:GetService('ReplicatedStorage').RainbowText:Clone()
			rainbow.Parent = msgclone
			msgclone.Text = "[Co-Founder]"..msg
		elseif plr == "Player1" then
			local rainbow = game:GetService('ReplicatedStorage').RainbowText:Clone()
			rainbow.Parent = msgclone
			msgclone.Text = "[Founder]"..msg
		end
	end
	if Chatcount >= Maxchats then
		Maxchats = Maxchats + 1
		CanvasSizea = CanvasSizea + 1
		script.Parent.ChatWindow.ScrollingFrame.CanvasSize = UDim2.new(0, 0, CanvasSizea, 0)
	end
	
end

Server-Side Code Here:

game:GetService('ReplicatedStorage').ChatFunctions.FilterChat.OnServerInvoke = function(plr,Msg)
		local FilteredMessage = game.Chat:FilterStringForBroadcast(Msg, plr)
		game:GetService('ReplicatedStorage').ChatFunctions.PublicChat:Invoke(plr, FilteredMessage)
		print(plr.." Said: "..FilteredMessage)
		end

1 comment

0

I believe it has something to do with the server-side code