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

Help with On.Chatted:connect????

Asked by 9 years ago

My error :sub is not a valid member of Player. Line : 312 field FUNC Line : 274 global Chatted

Like whats the problem I dont understand....

Commands={}
Bet=';'

Cmd=function(Command,Desc,Name,Func)
if Command==nil or '' then Command=('_Command_Error_') end
if Desc==nil or '' then Desc=('_Command_Error_') end
if Name==nil or '' then Name=('_Command_Error_') end
table.insert(Commands,{COMMAND=Command,DESC=Desc,NAME=Name,FUNC=Func})
end

Chatted=function(Plr,Msg)
    for _,data in pairs(Commands) do
        if Msg:sub(1,#(data.COMMAND:lower()..Bet)) then
            if Plr:IsInGroup(1199497) then
                Msg=Msg:sub(1,#data.COMMAND:lower()+#Bet+1)
                data.FUNC(Plr,Msg)
            end
            else Notication(Plr,'Error')
        end
    end
end

for _, Plr in pairs(game.Players:GetPlayers()) do
    Plr.Chatted:connect(function(Msg)
        Chatted(Plr,Msg)
    end)
end

Answer this question