I'm trying to create a custom chat GUI, and I am trying to get the event to send several parameters to the RemoteEvent and then be picked up, but when I attempt to do so, it says it is unable to cast value to object? Line 21
local uis = game:GetService("UserInputService")
local typing = false
local isInGroup = false
local assetID = 678387464
local isAlphaTester = false
local notInGroupColor = Color3.new(100/255,100/255,100/255)
local isInGroupColor = Color3.new(255/255,255/255,255/255)
local data = game:GetService("DataStoreService"):GetDataStore("Moderators_CHATTHINGDEV")
local moderator = data:GetAsync(game.Players.LocalPlayer.UserId.."_key",data)
uis.InputBegan:connect(function(input,gameProcessedEvent)
if input.KeyCode == Enum.KeyCode.Return or input.KeyCode == Enum.KeyCode.KeypadEnter then
script.Parent.ChatBox.FocusLost:connect(function()
if script.Parent.ChatBox.Text ~= "" and script.Parent.ChatBox.Text ~= "Click here or press "/" to type!" then
local message = script.Parent:WaitForChild("ChatBox").Text
local filteredMessage = game:GetService("Chat"):FilterStringForBroadcast(message,game.Players.LocalPlayer)
if game.Players.LocalPlayer:GetRankInGroup(3127454) >= 250 then
isInGroup = true
end
isAlphaTester = game:GetService("MarketplaceService"):PlayerOwnsAsset(game.Players.LocalPlayer,assetID)
game.Workspace.ChatEvent:FireClient(game.Players.LocalPlayer.Name,isInGroup,isAlphaTester,false,moderator,filteredMessage) --Offending line
script.Parent.ChatBox.Text = 'Click here or press "/" to type!'
end
end)
elseif input.KeyCode == Enum.KeyCode.Slash then
if not typing then
script.Parent:WaitForChild("ChatBox"):CaptureFocus()
end
end
end)
script.Parent:WaitForChild("ChatBox").FocusLost:connect(function()
typing = false
end)
script.Parent:WaitForChild("ChatBox").Focused:connect(function()
typing = true
end)
game.Workspace.ChatEvent.OnClientEvent:connect(function(player,group,alpha,bot,isModerator,message)
local constructedMessage = ""
wait()
local position = #script.Parent.Sliding:GetChildren()*20
local text = Instance.new("TextLabel",script.Parent.Sliding)
text.TextColor3 = notInGroupColor
text.Size = UDim2.new(1,0,0,20)
if isInGroup then
text.TextColor3 = isInGroupColor
end
text.Position = UDim2.new(0,0,0,position)
if not bot then
constructedMessage = player..": "..message
if game.Players.LocalPlayer.UserId == game.CreatorId then
constructedMessage = "[Developer] "..constructedMessage
text.TextColor3 = Color3.new(1,0,0)
elseif isModerator then
constructedMessage = "[MODERATOR] "..constructedMessage
text.TextColor3 = Color3.new(170/255, 0, 255/255)
elseif isAlphaTester then
constructedMessage = "[Alpha] "..constructedMessage
else
end
else
constructedMessage = "[BOT] "..constructedMessage
text.TextColor3 = Color3.new(255/255, 170/255, 0/255)
end
text.Text = constructedMessage
text.BackgroundTransparency = 1
text.TextScaled = true
text.TextWrapped = true
text.TextXAlignment = Enum.TextXAlignment.Left
text.TextYAlignment = Enum.TextYAlignment.Top
script.Parent.Sliding.CanvasSize = UDim2.new(0,0,0,script.Parent.Sliding.CanvasSize.Y.Offset+20)
script.Parent.Sliding.CanvasPosition = Vector2.new(0,script.Parent.Sliding.CanvasPosition.Y+20)
end)

1 comment
Which line? The output will say which line where the script errors.