The text filtration script that I made does not work for some reason. I want to make the Script print the filtered text on the Developer Console, but it just keeps on printing "Instance".
I do not know what is happening here, and I would be glad to have a solution for this.
Here is my code below:
LocalScript for the client:
LandMgr.Background.SubmitButton.Activated:Connect(function() LandRenameEvent:FireServer(Player, LandMgr.Background.PlotName.Text) end) -- When the player clicks on the submit button, send the "raw" text and the player who posted it to the Server
Script for the server:
local TextService = game:GetService("TextService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local LandRenameEvent = Instance.new("RemoteEvent") LandRenameEvent.Name = "LandRenameEvent" LandRenameEvent.Parent = ReplicatedStorage local function getTextObject(message, fromPlayerId) local textObject local success, errorMessage = pcall(function() textObject = TextService:FilterStringAsync(message, fromPlayerId) end) if success then return textObject elseif errorMessage then print("Error generating TextFilterResult:", errorMessage) end return false end -- The function to filter the text local function getFilteredMessage(textObject) local filteredMessage local success, errorMessage = pcall(function() filteredMessage = textObject:GetNonChatStringForBroadcastAsync() end) if success then return filteredMessage elseif errorMessage then print("Error filtering message:", errorMessage) end return false end -- Fired when client sends a request to write message local function onSetSignText(player, text) if text ~= "" then -- filter the incoming message and send the filtered message local messageObject = getTextObject(text, player.UserId) local filteredText = "" filteredText = getFilteredMessage(messageObject) print(filteredText) -- Print the filtered text end end LandRenameEvent.OnServerEvent:Connect(onSetSignText) -- When the player clicks the submit button from the client it fires this remote event; triggering the function onSetSignText()