I still cant figure out how to filter this but I dont wanna mess the script up. its a script where when you say /me it will have a little text on your head pop up but i can't figure out how to filter it. Any way to filter it?
local cmds = { walks = function() game.Players.LocalPlayer.Character.Humanoid.WalkToPoint = game.Players.LocalPlayer.Character.Torso.Position+Vector3.new(math.random(-10,10),0,math.random(-10,10)) end, sits = function() game.Players.LocalPlayer.Character.Humanoid.Sit = true end, jumps = function() game.Players.LocalPlayer.Character.Humanoid.Jump = true end, dies = function() game.Players.LocalPlayer.Character.Humanoid.PlatformStand = true end, } game.Players.LocalPlayer.Chatted:connect(function(msg) local first = string.sub(msg, 1,3) if first == "/me" then if game.Players.LocalPlayer.Character.Head:FindFirstChild("Emote") then game.Players.LocalPlayer.Character.Head.Emote:Destroy() end local gui = Instance.new("BillboardGui", game.Players.LocalPlayer.Character.Head) gui.Name = "Emote" gui.Size = UDim2.new(6,0,3,0) gui.StudsOffset = Vector3.new(0,3.8,0) local label = Instance.new("TextLabel", gui) label.Text = "*"..string.sub(msg, 5, string.len(msg)).."*" label.BackgroundTransparency = 1 label.Size = UDim2.new(1,0,1,0) label.Font = "SourceSansBold" label.FontSize = "Size12" label.TextScaled = true label.TextWrapped = false label.TextStrokeTransparency = 0 label.TextColor3 = Color3.new(0/255,0/0,0/255) for i,v in pairs(cmds) do if msg == "/me "..i then cmds[i]() end end wait(5) if gui then gui:Destroy() end end end)
You can use :FilterStringForBroadcast
. Like this.
local cmds = { walks = function() game.Players.LocalPlayer.Character.Humanoid.WalkToPoint = game.Players.LocalPlayer.Character.Torso.Position+Vector3.new(math.random(-10,10),0,math.random(-10,10)) end, sits = function() game.Players.LocalPlayer.Character.Humanoid.Sit = true end, jumps = function() game.Players.LocalPlayer.Character.Humanoid.Jump = true end, dies = function() game.Players.LocalPlayer.Character.Humanoid.PlatformStand = true end, } game.Players.LocalPlayer.Chatted:connect(function(msg) local first = string.sub(msg, 1,3) if first == "/me" then if game.Players.LocalPlayer.Character.Head:FindFirstChild("Emote") then game.Players.LocalPlayer.Character.Head.Emote:Destroy() end local gui = Instance.new("BillboardGui", game.Players.LocalPlayer.Character.Head) gui.Name = "Emote" gui.Size = UDim2.new(6,0,3,0) gui.StudsOffset = Vector3.new(0,3.8,0) local label = Instance.new("TextLabel", gui) label.Text = "*"..game.Chat:FilterStringForBroadcast(string.sub(msg, 5, string.len(msg)), game.Players.LocalPlayer).."*" label.BackgroundTransparency = 1 label.Size = UDim2.new(1,0,1,0) label.Font = "SourceSansBold" label.FontSize = "Size12" label.TextScaled = true label.TextWrapped = false label.TextStrokeTransparency = 0 label.TextColor3 = Color3.new(0/255,0/0,0/255) for i,v in pairs(cmds) do if msg == "/me "..i then cmds[i]() end end wait(5) if gui then gui:Destroy() end end end)
Another example would be this to filter a print function.
local message = 'this might be a bad word.' local player = game.Players.LocalPlayer print(game.Chat:FilterStringForBroadcast(msg, player))
You can also test this by filtering numbers cuz roblox doesn't like numbers.
local number = 3 local player = game.Players.LocalPlayer print(game.Chat:FilterStringForBroadcast(msg, player))
This will print "#" because roblox does not like numbers. Please accept answer if this helps!