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

It is possible to filter a string?

Asked by
gloveshun 119
5 years ago
Edited 5 years ago

My chat won't work because it needs a chat filter, but everything I try it fails

local msg = game.Chat:FilterStringForBroadcast(message)

This returns nil There is a secret way to filter? EDIT:

--This is the script what works
local suc, errormsg = pcall(function()
int2.Name = plr.Name.." is now Joined!!!"
end)
if suc then
    print("Success!")
else
    warn("Fail, " .. errormsg)
end
plr.Chatted:Connect(function(msg)
local int = script.Parent.Chats
local int2 = Instance.new("StringValue", int)
local msg2 = string.upper(msg:sub(0, 1))..msg:sub(2)
local biztositek = string.len(msg2)
local biztositek2 = "."
if string.sub(msg2, biztositek) == "!" or string.sub(msg2, biztositek) == "?" then
    biztositek2 = ""
end
local suc, errormsg = pcall(function()
int2.Name = plr.Name..": "..msg2..biztositek2
int2.Value = biztositek
end)
if suc then
    print("Success!")
else
    warn("Fail, " .. errormsg)
end
end)
end)
game.Players.PlayerRemoving:Connect(function(plr)
    wait(1)
    local int = script.Parent.Chats
local int2 = Instance.new("StringValue", int)
local suc, errormsg = pcall(function()
int2.Name = plr.Name.." is now Left."
end)
if suc then
    print("Success!")
else
    warn("Fail, " .. errormsg)
end
end)
0
Please note that filtering does not work inside roblox studio. RubenKan 3615 — 5y
0
But not works in global server gloveshun 119 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

It returns nil because there is nothing in (message)

you need to use Player.Chatted event then connect it to a function ,the parameter would be what the player is saying ,use the parameter from player.chatted and put it in ,Chat:FilterStringForBroadcast(chat parameter)

0
ok gloveshun 119 — 5y
0
But you looks me a noob gloveshun 119 — 5y
Ad

Answer this question