Guest User

4nn1's Place script

a guest
Jun 3rd, 2024
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | Source Code | 0 0
  1. local prefix = "!"
  2.  
  3. game.Players.PlayerAdded:Connect(function(player)
  4. player.Chatted:Connect(function(message)
  5. if string.sub(message, 1, 1) == prefix then
  6. local command = string.sub(message, 2)
  7. local playerName = player.Name
  8.  
  9. if command == "boom" then
  10. local targetName = string.match(playerName, "%w+")
  11. local targetPlayerName = string.sub(message, 7) -- Assuming the name starts at index 7
  12.  
  13. for _, mobName in ipairs({"muffy", "socky"}) do
  14. local mob = game.Workspace:FindFirstChild(mobName)
  15. if mob then
  16. local targetPlayer = game.Players:FindFirstChild(targetPlayerName)
  17. if targetPlayer then
  18. player.Character:MoveTo(mob.Position)
  19. targetPlayer.Character:MoveTo(mob.Position)
  20. wait(2) -- Wait for the teleportation
  21. mob:Destroy()
  22. else
  23. player:Kick("Player not found!")
  24. end
  25. else
  26. player:Kick("Mob not found!")
  27. end
  28. end
  29. end
  30. end
  31. end)
  32. end)
  33.  
  34. print("Script executed!")
  35.  
Advertisement
Add Comment
Please, Sign In to add comment