So lately I have been thinking is there a way to mirror or flip the player’s message when they chat.
Example.
Hello How are you? = ?uoy era woH ollwH
Any help would be appreciated.
So lately I have been thinking is there a way to mirror or flip the player’s message when they chat.
Example.
Hello How are you? = ?uoy era woH ollwH
Any help would be appreciated.
You could use string.reverse()
in a player.Chatted
event.
Adding onto what Amora said, here’s an example
game:GetService("Players").PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
local reversed = message:reverse() -- string.reverse(message) will have the same effect
print(reversed)
end)
end)
You could also add a RemoteEvent to fire, where the client will then make a message in chat with it.
local Players = game:GetService("Players")
local replicatedStorage = game:GetService("ReplicatedStorage")
Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message, recipient)
local reversedMessage = string.reverse(message)
print(reversedMessage)
replicatedStorage:WaitForChild("SendReversedMessage"):FireAllClients(player.Name, reversedMessage)
end)
end)
local replicatedStorage = game:GetService("ReplicatedStorage")
local starterGui = game:GetService("StarterGui")
replicatedStorage:WaitForChild("SendReversedMessage").OnClientEvent:Connect(function(playerName, message)
starterGui:SetCore("ChatMakeSystemMessage",{
Text = "["..playerName.."]: "..message;
Color = Color3.fromRGB(255, 75, 75);
font = Enum.Font.SourceSansSemibold;
FontSize = Enum.FontFize.Size32;
})
end)
I suggest when you do implement the function that you put the reversed text through TextService:FilterStringAsync(), even if you only grab the messages that the filter accepts.
If someone finds a way to bypass that filter (i.e reversing the word), your game and/or account could be liable to face moderation.
From what @x1_EE and I did (using a Player.Chatted
event), that is unnecessary because it will pass the already automatically filtered message into the string.reverse
, so the chat filter cannot be bypassed. The chat filter will filter inappropriate words spelt backwards.
Because I’m just WONDERING. What, is it a CRIME to be curious?
I didn’t say it’s a crime, I just asked