It will be alot easier to make a command a new way using a function called onChatted(message, player)
01 | Admins = { "doctorbenny2011" } |
03 | function onChatted(message, player) |
04 | if string.lower(message:sub( 1 , 7 )) = = "Vortex " then |
05 | if Admins [ player.Name ] then |
06 | if message:sub( 8 ) = = "Open!" or "open!" then |
08 | elseif message:sub( 8 ) = = "Close!" or "close!" then |
14 | game.Players.PlayerAdded:connect( function (player) |
15 | player.Chatted:connect( function (message) onChatted(message, player) end ) |
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(message) onChatted(message, player) end)
end)
Calls the function every time someone talks when they are added to the server and sends the function the arguments message, player.
if message.lower(:sub(1,7)) == "Vortex " then
this checks the first 7 letters of the word for Vortex with a space afterwards.
if Admins[player.Name] then
This finds the table Admins and searches for the players name from the game.Players.PlayerAdded event and checks if it matches any of the names in the list.
if message:sub(8) == "Open!" or "open!" then
This then checks the letters after 8 to see if they match Open! or open! and calls the function on()
elseif message:sub(8) == "Close!" or "close!" then
This does the same as Open! but calls the function off()