Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how would I filter this script iv tried but it wont work, any way to filter it without breaking it?

Asked by 6 years ago
Edited 6 years ago

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)
0
Filter? PyccknnXakep 1225 — 6y
0
How to add a filter to the script. So it hashtags it instead of ppl being able to get my game reviewed (lmao) Sergiomontani10 236 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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!

Ad

Answer this question