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

Radio filter script not working and doesn't send message?

Asked by 6 years ago

Basically I found this radio I like but I need to filter it so I tried but I failed. So I need help. Also when I try to type something into the radio in game nothing shows up?

local cs = {}

prmy = {
    ["Line1"] = "",
    ["Line2"] = "",
    ["Line3"] = "",
    ["Line4"] = "",
    ["Line5"] = "",
}

local function filter(plr, msg)
    return game.Chat:FilterStringAsync(msg, plr, plr)

end
local function CS(plr, msg)
    return game.Chat:FilterStringAsync(cs, msg , plr)
end

game.ReplicatedStorage.Radio.send.OnServerEvent:connect(function(plr, msg)
    if msg == "__*GET" then
        game.ReplicatedStorage.Radio.send:FireClient(plr, prmy)
    else
        msg = CS(cs , plr , msg)[plr.Name][1].." - "..filter(plr, msg)

        if msg == cs[plr.Name][1].." - **DISTRESS SIGNAL FIRED**" and prmy["Line5"] == msg then return end

        prmy["Line1"] = prmy["Line2"]
        prmy["Line2"] = prmy["Line3"]
        prmy["Line3"] = prmy["Line4"]
        prmy["Line4"] = prmy["Line5"]
        prmy["Line5"] = msg

        game.ReplicatedStorage.Radio.send:FireAllClients(prmy)
        return
    end
end)

The one I want to filter is the local function CS(callsign)

Answer this question