A simple chat message repeater

I want a chat repeating command that will cycle between "i am outnumbered’ and ‘help me brother’ with a 10 second pause inbetween each input- activated by “+emote” in console.

`Serverside piece:
–You should be able to add however many phrases you like without a problem
local phrases = {“I am outnumbered!”, “Help me, brother!”}
local status = 0

function cycle_phrases(player, command, args)
local n = 1
status = math.floor(args[1])
–Keep the below commented out if you always want to start by printing the first statement
–Leaving it commented means that if you stop pressing at n = 2 in a 3-item list, it’ll print the second item and then continue on
–n = 1

if status == 1 then
    player:ConCommand("say " .. phrases[n])
    timer.Create("repeater", 10, 0, function()
                                        if status then
                                            n = n + 1
                                            if n > #phrases then n = 1 end
                                            player:ConCommand("say " .. phrases[n])


concommand.Add(“emote”, cycle_phrases)

Clientside piece:
concommand.Add("+emote", function() RunConsoleCommand(“emote”, “1”) end)
concommand.Add("-emote", function() RunConsoleCommand(“emote”, “0”) end)

Where/how should I save these? I tried a few different ways and they all gave me nil value errors for ‘player’ and of ‘floor’ not having a number when it was expected.

I’m figuring it’s my fault.

If you just want to use these as scripts and not as a part of a gamemode, stick the serverside piece in “lua/autorun/server/” and the clientside piece in “lua/autorun/client/” as new .lua files. If you want this in a gamemode, you need to put the serverside piece in a file that is being called on the server and the clientside piece in a file that is being called on the client.

Definitely my bad, works now- thanks a ton dude.