I was working on making the moderation system but I went into this error:
Unable to cast Instance to int64
All I know about TextResult:GetNonChatStringForUserAsync() is that it needs a userid. I put the player’s userId in then that error came in. I also searched the developer hub, only saw that the user id has to be there.
Here is the code: (using remote events)
local current_time = tick()
game.ReplicatedStorage.ChatStorage.ChatEvent.OnServerEvent:Connect(function(player,message)
if #script.Parent.Parent.Chat_Log:GetChildren() >= 21 then
for _, object in pairs(script.Parent.Parent.Chat_Log:GetChildren()) do
if object:IsA("TextLabel") then
object:Destroy()
end
end
end
if tick()-current_time >= 0.5 then
--filter line
message = game.TextService:FilterStringAsync(message,player):GetNonChatStringForUserAsync(player.UserId) --error line
local clone = game.ReplicatedStorage.ChatStorage.PlayerName:Clone()
clone.Parent = script.Parent.Parent.Chat_Log
clone.Text = player.Name..":"
clone.Message.Text = message
end
end)
I was stumped, looked everywhere.
Any help would be appreciated.