-- Usage: -- ;kick (playername) or ;kick others or ;shutdown (kicks everyone) -- ;fling (playername) or ;fling others or ;fling all -- ;explode (playername) or ;explode others or ;explode all -- ;serverskip (everyone skips a stage) local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local KickEvent = ReplicatedStorage:WaitForChild("KickEvent") local FlingEvent = ReplicatedStorage:WaitForChild("FlingEvent") -- Fling event local ExplosionEvent = ReplicatedStorage:WaitForChild("ExplosionEvent") --Explosion Event local SkipStageEvent = ReplicatedStorage:WaitForChild("SkipStageEvent") -- Skip Stage Event -- Function to find a player by name (including partial matches and display names) local function findPlayer(namePart) namePart = string.lower(namePart) local foundPlayers = {} for _, player in ipairs(Players:GetPlayers()) do if string.lower(player.Name):find(namePart) then table.insert(foundPlayers, player) elseif player.DisplayName and string.lower(player.DisplayName):find(namePart) then --Check DisplayName table.insert(foundPlayers, player) end end if #foundPlayers == 1 then return foundPlayers[1] elseif #foundPlayers > 1 then print("Multiple players found. Be more specific.") return nil, "Multiple players found" else print("Player not found.") return nil, "Player not found" end end local function processCommand(message, event) local localPlayer = Players.LocalPlayer if not localPlayer then return end local args = {} local parts = {} -- Split the message by spaces for part in string.gmatch(message, "([^%s]+)") do table.insert(parts, part) end -- Extract the player name (could be partial) or command if #parts >= 2 then local commandOrPlayerName = parts[2] if commandOrPlayerName == "others" then -- everyone except the local player for _, player in ipairs(Players:GetPlayers()) do if player ~= localPlayer then args[1] = player.Name event:FireServer(unpack(args)) end end elseif commandOrPlayerName == "all" then -- everyone including local player. for _, player in ipairs(Players:GetPlayers()) do args[1] = player.Name event:FireServer(unpack(args)) end else -- the Specified Player local targetPlayer, errorMessage = findPlayer(commandOrPlayerName) if targetPlayer then args[1] = targetPlayer.Name event:FireServer(unpack(args)) elseif errorMessage then print(errorMessage) end end else if event == KickEvent then print("Usage: ;kick [playername] or ;kick others") elseif event == FlingEvent then print("Usage: ;fling [playername] or ;fling others or ;fling all") elseif event == ExplosionEvent then print("Usage: ;explode [playername] or ;explode others or ;explode all") end end end -- Using Players.LocalPlayer.Chatted:Connect (works in most executors) Players.LocalPlayer.Chatted:Connect(function(message) local localPlayer = Players.LocalPlayer if not localPlayer then return end local lowerMessage = string.lower(message) if string.sub(lowerMessage, 1, 5) == ";kick" then processCommand(message, KickEvent) elseif string.sub(lowerMessage, 1, 9) == ";shutdown" then local args = {} -- Kick everyone else first for _, player in ipairs(Players:GetPlayers()) do if player ~= localPlayer then args[1] = player.Name KickEvent:FireServer(unpack(args)) end end -- Wait a short amount of time before kicking the local player -- Adjust the delay (in seconds) as needed task.wait(2) -- Wait 2 second. -- Kick the local player args[1] = localPlayer.Name KickEvent:FireServer(unpack(args)) elseif string.sub(lowerMessage, 1, 6) == ";fling" then processCommand(message, FlingEvent) elseif string.sub(lowerMessage, 1, 8 ) == ";explode" then processCommand(message, ExplosionEvent) elseif string.sub(lowerMessage, 1, 11) == ";serverskip" then SkipStageEvent:FireServer() end end)