Okay, I am making an admin script, but on commands, such as rejoin and reset it requires a players name, and I don't want them commands to have that. Only kick and kill should have it. i.e. ;kick mosski123
Here is my code;
01 | local Admins = { |
02 | [ "19498972" ] = true , |
03 | [ "1540993" ] = true , |
04 | [ "46641586" ] = true |
05 | } |
06 |
07 | local prefix = ';' |
08 |
09 | local commandTable = { } |
10 |
11 |
12 | function findPlayer(name) |
13 | for _, player in ipairs (game.Players:GetPlayers()) do |
14 | if player.Name:lower() = = name:lower() then |
15 | return player |
I suggest you use String Manipulation. To be specific: string.sub(). What this done is it takes out a specificied section out of a string. This means that you can assign the player as a seperate variable by using string.sub().
For example, if you wanted to kill a player, do:
local target = string.sub(message, 6)
The above will take out anything said after ;kick or ;kill.