Why does my kill command only kill the player saying it and not everyone?
I'm trying to make admin commands by linking modules to different sections.
So far, my script connects to the correct command module, which then brackets off to the parser which determines what player/group it's going to perform the command on, it then brackets off to the player/group module which then tells the script how it's going to run; Eg. Group: All - would select all players - It would then return that module back to the original kill module and kill everyone...
However, the modules aren't working in the correct way and is only causing the speaker to die instead of the whole server..
Any ideas?
Kill Command Module
01 | return function (Speaker, plrName ) |
03 | local ThePlayer = require(script.Parent.Parent.Settings.Groups.Parser) |
04 | local selectedPlayer = ThePlayer.Obj(plrName) |
05 | if typeof(selectedPlayer) = = "table" then |
06 | for _, v in pairs (selectedPlayer) do |
10 | selectedPlayer:BreakJoints() |
13 | print ( string.format( "Testing command on : '%s'!" , plrName) ) |
15 | warn( string.format( "command '%s' got invalid arguments. Skipping.." , script.Name ) ) |
Parser Module
2 | function module.Obj(plrName) |
3 | if plrName:lower() = = "!all" then |
4 | local AllPlayers = require(script.Parent.AllPlayers) |
5 | return AllPlayers.Obj(plrName) |
AllPlayers Module
02 | function module.Obj(plrName) |
03 | local plrs = game:GetService( "Players" ) |
04 | for i, player in pairs (plrs:GetPlayers()) do |
05 | plrName = player.Character |
Thank you in-advance!