I have a game where you can print whatever words you want from a printer but players can print unfiltered swear words, the game is singleplayer so is that a problem? if so how can I filter the text?
Can you show me the code when your printer prints the text?
Like:
for _,filter in ipairs(filterWords) do
if filter in textToPrint then
-- if blacklist word
else
-- if no blacklist word
end
end
You must filter text only if this text saved and loaded back to player, even for the same player. In other situations - nope.
I know it’s spaghetti code
script.Parent.MouseButton1Click:Connect(function()
local paper = game.ReplicatedStorage.Part:Clone()
local label = paper.SurfaceGui.TextLabel
local screenGuiText = script.Parent.Parent.TextBox
local surfaceGuiText = label
local button = script.Parent
surfaceGuiText.Text = screenGuiText.Text
label.Font = script.Parent.Parent.TextBox.Font
paper.Parent = game.Workspace
paper.Position = game.Workspace.printer.printpart.Position
paper.Orientation = game.Workspace.printer.printpart.Orientation
local tweenService = game:GetService("TweenService")
local part = paper
local tweeningInformation = TweenInfo.new(
2, -- lenght
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0, -- if repeating is true then how many times should it repeat?
false, -- repeating?
0 -- delay
)
local partProperties = {
Position = game.Workspace.printer.paperdone.Position;
}
local Tween = tweenService:Create(part,tweeningInformation,partProperties)
Tween:Play()
game.Workspace.printer.printpart.Printer:Play()
script.Parent.Visible = false
script.Parent.BackgroundColor3 = Color3.fromRGB(135, 135, 136)
wait(2)
script.Parent.BackgroundColor3 = Color3.fromRGB(143, 143, 144)
script.Parent.Visible = true
end)
Didn’t bother to remove the BackgroundColor3 stuff
If the text is going to be displayed to other users it must be filtered. If the text is only going to be displayed to the user that wrote it I don’t think it needs to be filtered(I can’t find much official information and only went off what it says in the developer hub page below). However, I would filter it anyway just to be safe.
At the bottom of this page it sort of answers your question about whether to filter text if it’s only displayed to the user that wrote it.
1 Like