Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local commands = {}
- local prefix = "!"
- local function FindPlayer(name, sender)
- for i, player in pairs(game.Players:GetPlayers()) do
- if string.lower(player.Name) == name then
- return player
- elseif name == "me" then
- return sender
- end
- end
- return nil
- end
- local function FindTool(name)
- for i, tool in pairs(game.ServerStorage.Tools:GetChildren()) do
- if string.lower(tool.Name) == name then
- return tool
- end
- end
- return nil
- end
- commands.kick = function(sender, arguments)
- local kickPlayer = arguments[1]
- if kickPlayer then
- local player = FindPlayer(kickPlayer, sender)
- if player then
- player:kick(sender.Name.." has kicked you from this game.")
- end
- end
- end
- commands.give = function(sender, arguments)
- local item = arguments[1]
- if item then
- local Tool = FindTool(item)
- if Tool then
- local Clone = Tool:Clone()
- Clone.Parent = sender.Backpack
- end
- end
- end
- commands.tp = function(sender, arguments)
- local PlayerToTP = arguments[1]
- local PlayerTPTo = arguments[2]
- if PlayerToTP and PlayerTPTo then
- local TpPlayer = FindPlayer(PlayerToTP, sender)
- local Pos = FindPlayer(PlayerTPTo, sender)
- if TpPlayer and Pos then
- TpPlayer.Character:PivotTo(Pos.Character.HumanoidRootPart.CFrame + Vector3.new(0, 5, 0))
- end
- end
- end
- commands.speed = function(sender, arguments)
- local speedPlayer = arguments[1]
- local speed = arguments[2]
- if speedPlayer and speed then
- local player = FindPlayer(speedPlayer, sender)
- if player then
- player.Character.Humanoid.WalkSpeed = speed
- end
- end
- end
- commands.invisible = function(sender, arguments)
- local invisiblePlayer = arguments[1]
- if invisiblePlayer then
- local player = FindPlayer(invisiblePlayer, sender)
- if player then
- local character = player.Character
- if character then
- for i, part in pairs(character:GetDescendants()) do
- if part:IsA("Decal") then
- part.Transparency = 1
- end
- if part:IsA("BasePart") then
- part.Transparency = 1
- end
- end
- end
- end
- end
- end
- commands.visible = function(sender, arguments)
- local visiblePlayer = arguments[1]
- if visiblePlayer then
- local player = FindPlayer(visiblePlayer, sender)
- if player then
- local character = player.Character
- if character then
- for i, part in pairs(character:GetDescendants()) do
- if part:IsA("Decal") then
- part.Transparency = 0
- end
- if part:IsA("BasePart") then
- if part.Name == "HumanoidRootPart" then
- part.Transparency = 1
- else
- part.Transparency = 0
- end
- end
- end
- end
- end
- end
- end
- commands.highlight = function(sender, arguments)
- local highlightPlayer = arguments[1]
- if highlightPlayer then
- local Player = FindPlayer(highlightPlayer, sender)
- if Player then
- local character = Player.Character
- if character then
- local highlight = Instance.new("Highlight", character)
- end
- end
- end
- end
- commands.kill = function(sender, arguments)
- local killPlayer = arguments[1]
- if killPlayer then
- local Player = FindPlayer(killPlayer, sender)
- if Player then
- local character = Player.Character
- if character then
- character.Humanoid.Health = 0
- end
- end
- end
- end
- commands.explode = function(sender, arguments)
- local explodePlayer = arguments[1]
- if explodePlayer then
- local Player = FindPlayer(explodePlayer, sender)
- if Player then
- local character = Player.Character
- if character then
- local explosion = Instance.new("Explosion", character)
- explosion.Position = character.HumanoidRootPart.Position
- end
- end
- end
- end
- game.Players.PlayerAdded:Connect(function(player)
- player.Chatted:Connect(function(message, recipient)
- message = string.lower(message)
- local splitString = message:split(" ")
- local slashCommand = splitString[1]
- local cmd = slashCommand:split(prefix)
- local cmdName = cmd[2]
- if commands[cmdName] then
- local arguments = {}
- for i = 2, #splitString, 1 do
- table.insert(arguments, splitString[i])
- end
- commands[cmdName](player, arguments)
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement