local Repli = game:GetService("ReplicatedStorage")
Repli.BoothText.OnServerEvent:Connect(function(player, BoothText)
local Boothnumber = player.hasBooth
if Boothnumber.Value ~= 0 then
local Booths = game.Workspace.Booths:GetChildren()
for i, v in pairs(Booths) do
if v.Name == tostring(Boothnumber.Value) then
v.TextPart.SurfaceGui.TextBox.Text = BoothText
end
end
end end)
I want to filter the BoothText with the Roblox filtering but I just can’t figure it out I’ve been trying for some time now. If you could help me you would make my day!
local Repli = game:GetService("ReplicatedStorage")
Repli.BoothText.OnServerEvent:Connect(function(player, BoothText)
local Boothnumber = player.hasBooth
if Boothnumber.Value ~= 0 then
local Booths = game.Workspace.Booths:GetChildren()
for i, v in pairs(Booths) do
if v.Name == tostring(Boothnumber.Value) then
local message = game.Chat:FilterStringForBroadcast(BoothText, player)
v.TextPart.SurfaceGui.TextBox.Text = message
end
end
end end)
idk if thats the righ way but it doesnt filter text
local Repli = game:GetService("ReplicatedStorage")
Repli.BoothText.OnServerEvent:Connect(function(player, BoothText)
local Boothnumber = player:FindFirstChild("hasBooth")
if not Boothnumber then
warn("Boothnumber invalid")
return
end
if Boothnumber.Value ~= 0 then
print("Continue")
local Booths = workspace.Booths:GetChildren()
for i, v in pairs(Booths) do
print(Boothnumber.Value, v.Name == tostring(Boothnumber.Value))
if v.Name == tostring(Boothnumber.Value) then
local message = game:GetService("Chat"):FilterStringForBroadcast(BoothText, player)
v.TextPart.SurfaceGui.TextBox.Text = message
end
end
end
end)
If everything prints, you should be fine and it’s a studio thing.
Perfect, however please make sure to wrap FilterStringAsync in a pcall, since it’s a network bound function, it might fail and break your script!
Always use pcall when the function name contains “Async”.
local Chat = game:GetService("Chat")
local Success, message = pcall(Chat.FilterStringForBroadcast, Chat, BoothText, player)
if Success then
v.TextPart.SurfaceGui.TextBox.Text = message
else
warn(message)
end