LynXS_

Untitled

Jun 27th, 2024
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.92 KB | None | 0 0
  1. -- Script for Roblox Executors
  2.  
  3. local Players = game:GetService("Players")
  4. local LocalPlayer = Players.LocalPlayer
  5.  
  6. -- Function to teleport a character to a specific position
  7. local function teleportPlayer(targetCharacter, destinationPosition)
  8. if targetCharacter and targetCharacter:FindFirstChild("HumanoidRootPart") then
  9. targetCharacter.HumanoidRootPart.CFrame = CFrame.new(destinationPosition)
  10. else
  11. warn("Failed to teleport. Character or HumanoidRootPart not found.")
  12. end
  13. end
  14.  
  15. -- Function to handle chat commands
  16. local function onChatted(message)
  17. local args = string.split(message, " ")
  18. local command = args[1]
  19.  
  20. if command == ".teleport" or command == ".goto" then
  21. if #args ~= 3 then
  22. warn("Invalid format. Use: .teleport <me> <destination> or .goto <destination>")
  23. return
  24. end
  25.  
  26. local targetName = args[2]
  27. local destinationName = args[3]
  28.  
  29. if targetName ~= "me" and targetName ~= LocalPlayer.DisplayName and targetName ~= LocalPlayer.Name then
  30. warn("Target must be 'me', your display name, or your username.")
  31. return
  32. end
  33.  
  34. local destinationPlayer = Players:FindFirstChild(destinationName)
  35. if not destinationPlayer then
  36. warn("Destination player not found: " .. destinationName)
  37. return
  38. end
  39.  
  40. if LocalPlayer.Character and destinationPlayer.Character then
  41. local destinationPosition = destinationPlayer.Character.HumanoidRootPart.Position
  42. teleportPlayer(LocalPlayer.Character, destinationPosition)
  43. else
  44. warn("Failed to teleport. One of the players might not have a character loaded.")
  45. end
  46. elseif command == ".bring" then
  47. if #args ~= 2 then
  48. warn("Invalid format. Use: .bring <destination>")
  49. return
  50. end
  51.  
  52. local destinationName = args[2]
  53. local destinationPlayer = Players:FindFirstChild(destinationName)
  54. if not destinationPlayer then
  55. warn("Destination player not found: " .. destinationName)
  56. return
  57. end
  58.  
  59. if LocalPlayer.Character and destinationPlayer.Character then
  60. local localPlayerPosition = LocalPlayer.Character.HumanoidRootPart.Position
  61. teleportPlayer(destinationPlayer.Character, localPlayerPosition)
  62. else
  63. warn("Failed to bring. One of the players might not have a character loaded.")
  64. end
  65. elseif command == ".tpcoords" then
  66. if #args ~= 4 then
  67. warn("Invalid format. Use: .tpcoords <x> <y> <z>")
  68. return
  69. end
  70.  
  71. local x = tonumber(args[2])
  72. local y = tonumber(args[3])
  73. local z = tonumber(args[4])
  74.  
  75. if not x or not y or not z then
  76. warn("Invalid coordinates.")
  77. return
  78. end
  79.  
  80. local destinationPosition = Vector3.new(x, y, z)
  81. if LocalPlayer.Character then
  82. teleportPlayer(LocalPlayer.Character, destinationPosition)
  83. else
  84. warn("Failed to teleport to coordinates. Character not loaded.")
  85. end
  86. elseif command == ".help" then
  87. print("Available commands:")
  88. print(".teleport <me> <destination> - Teleport yourself to another player")
  89. print(".goto <destination> - Teleport yourself to another player (alias for .teleport)")
  90. print(".bring <destination> - Bring another player to your position")
  91. print(".tpcoords <x> <y> <z> - Teleport yourself to specific coordinates")
  92. print(".help - Display this help message")
  93. else
  94. warn("Unknown command. Type .help for a list of commands.")
  95. end
  96. end
  97.  
  98. LocalPlayer.Chatted:Connect(onChatted)
  99.  
  100. -- Usage examples:
  101. -- In the chat, you can type:
  102. -- .teleport me DestinationPlayer
  103. -- .goto DestinationPlayer
  104. -- .bring DestinationPlayer
  105. -- .tpcoords 100 50 100
  106. -- .help
  107.  
Advertisement
Add Comment
Please, Sign In to add comment