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

Unable to cast value to Object?

Hi, so i'm trying to make a custom chat gui feature and so I need to filter my chat. But when I try to do it I get this error: Unable to cast value to Object.

Filter Line:

local filteredText = game.Chat:FilterStringForBroadcast(Message, Speaker)

Where Message is coming from:

ChatEvent.OnClientEvent:connect(function(Request, Message, Speaker)
	Request = Request:lower()
	if Request == "chat" then
		CreateMessage(Message, Speaker)
	end
end)

Thanks :)

4 comments

0

I notice you used the code from my old chat system video :D. Most of the content in that video is very out of date, so I would recommend changing a lot.

0

Oh yeah! Thanks a lot for the video it helps me a lot for custom chat and would you know how to fix it since you made it? Its fine if you dont

0

What the CreateMessage() function?

0

I posted the CreateMessage() function

1 answer

There you go MinePlayersPE1

local function CreateMessage(Message, Speaker)
	local filteredText = game.Chat:FilterStringForBroadcast(Message, Speaker)
	local Label = Instance.new("TextLabel")
	Label.BackgroundTransparency = 1
	Label.TextXAlignment = "Left"
	Label.TextColor3 = Color3.new(1,1,1)
	Label.Font = "ArialBold"
	Label.FontSize = "Size18"
	Label.Size = UDim2.new(1,0,0,25)
	Label.Position = UDim2.new(0,0,1,-25)
	if game.CreatorId == Speaker.userId then
		Label.Text = "[OWNER]"..tostring(Speaker)..": "..filteredText
		Label.Label.TextColor3 = Color3.new(255/255, 147/255, 23/255)
	else
		Label.Text = tostring(Speaker)..": "..filteredText
	end
	PushMessages(Label.Size.Y.Offset)
	Chats[#Chats+1] = Label
	Label.Parent = ChatFrame
end

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