Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local prefix = "!"
- game.Players.PlayerAdded:Connect(function(player)
- player.Chatted:Connect(function(message)
- if string.sub(message, 1, 1) == prefix then
- local command = string.sub(message, 2)
- local playerName = player.Name
- if command == "boom" then
- local targetName = string.match(playerName, "%w+")
- local targetPlayerName = string.sub(message, 7) -- Assuming the name starts at index 7
- for _, mobName in ipairs({"muffy", "socky"}) do
- local mob = game.Workspace:FindFirstChild(mobName)
- if mob then
- local targetPlayer = game.Players:FindFirstChild(targetPlayerName)
- if targetPlayer then
- player.Character:MoveTo(mob.Position)
- targetPlayer.Character:MoveTo(mob.Position)
- wait(2) -- Wait for the teleportation
- mob:Destroy()
- else
- player:Kick("Player not found!")
- end
- else
- player:Kick("Mob not found!")
- end
- end
- end
- end
- end)
- end)
- print("Script executed!")
Advertisement
Add Comment
Please, Sign In to add comment