I'm trying to make it so that if someone in my list of admins types "/e msg (message)", it will create a new Message object in Workspace, display the message for 2.5 seconds, then destroy it. The problem is, when I try to use it, nothing happens and there is no output.
Here is the code:
local admins = {
"MrFlimsy"
"Interactivity"
"NotAshley"
}
function isAdmin(player)
for _,v in pairs(admins) do
if v == player then
return true
end
end
end
game.Players.PlayerAdded:connect(function(plr)
plr.Chatted:connect(function(msg)
local cmd = string.lower(msg)
if string.sub(cmd,1,7) == "/e msg " then
if string.len(cmd) > 7 then
if isAdmin(plr) then
local m = Instance.new("Message",workspace)
m.Text = string.sub(msg,8,string.len(cmd))
wait(2.5)
m:destroy()
end
end
end
end)
end)

1 comment
Thanks. I don't know how I overlooked that. +1 to you!