I have a script in my game that calls a temp-ban function when a player types /tempban. I want to use @waterrunner 's script, but I don’t know how to use it with my script:
local commands = {}
local prefix = "/"
local function findPlayer (name)
for i, player in pairs(game.Players:GetPlayers()) do
if string.lower(player.Name) == name then
return player
end
end
return nil
end
commands.tempban = function(sender,arguments)
end
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message,recipient)
local message = string.lower(message)
local splitString = message:split(" ")
local slashCommand = splitString[1]
local command = slashCommand:split(prefix)
local commandName = command[2]
print(commandName)
if commands[commandName] then
local arguments = {}
for i = 2, #splitString, 1 do
table.insert(arguments,splitString[i])
end
commands[commandName] (player,arguments)
end
end)
end)
How could I create a temp-ban script?