We are trying to create a custom chat for our game and when I use this script that my partner made, the chat just says "killertybear: Instance"

There are also no errors.

Local Script(Located inside GUI for chat)

local chatbox1 = script.Parent.cb1
local chatbox2 = script.Parent.cb2
local chatbox3 = script.Parent.cb3
local chatbox4 = script.Parent.cb4
local chatbox5 = script.Parent.cb5
local chatbox6 = script.Parent.cb6
game.Workspace.ChatStorage.ChildAdded:connect(function(chatstuff)
	
	chatbox1.Text = chatbox2.Text
	chatbox2.Text = chatbox3.Text
	chatbox3.Text = chatbox4.Text
	chatbox4.Text = chatbox5.Text
	chatbox5.Text = chatbox6.Text
	chatbox6.Text = chatstuff.Name
	chatbox1.TextColor3 = chatbox2.TextColor3
	chatbox2.TextColor3 = chatbox3.TextColor3
	chatbox3.TextColor3 = chatbox4.TextColor3
	chatbox4.TextColor3 = chatbox5.TextColor3
	chatbox5.TextColor3 = chatbox6.TextColor3
	chatbox6.TextColor3 = Color3.new(124, 124, 124)	
	wait(.1)
end)

game.Players.PlayerAdded:connect(function(player)
    player.Chatted:connect(function(msg)
		if player.Name == 'Player1' or 'killertybear' then
			chatbox6.TextColor3 = Color3.new(255,255,127)
		end	
	end)
end)

Server Script(In workspace)

local chatstorage = game.Workspace.ChatStorage
game.Players.PlayerAdded:connect(function(plr)
	plr.Chatted:connect(function(theirmessage)
		local stringval = Instance.new('StringValue', chatstorage)
		local filteredText = ""
		filteredText = game:GetService("Chat"):FilterStringForBroadcast(stringval, plr)
		local success, message = pcall(function()
		end)
		
		if not success then
			warn("Error filtering text: " .. theirmessage)
			filteredText = "##################"
		end
		
		if success then
			if plr.Name ==  'killertybear'  then
				stringval.Name = 'Developer '..plr.Name..': '..filteredText
				
				filteredText = theirmessage:FilterStringForBroadcast(theirmessage,plr)
			else
				stringval.Name = plr.Name..': '..filteredText
				filteredText = game:GetService("Chat"):FilterStringForBroadcast(stringval.Name,plr)
			end	
		end
		
	end)
end)

Thanks!

3 comments

0

What I think that is the problem is that its from line 19 through line 22

0

Try putting line 19 before line 17 and line 22 before line 21. On the second script

0

@MizeryGFX I did that and the dev console said, "attempt to call method 'FilterStringForBroadcast' a nil value