Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Script for Roblox Executors
- local Players = game:GetService("Players")
- local LocalPlayer = Players.LocalPlayer
- -- Function to teleport a character to a specific position
- local function teleportPlayer(targetCharacter, destinationPosition)
- if targetCharacter and targetCharacter:FindFirstChild("HumanoidRootPart") then
- targetCharacter.HumanoidRootPart.CFrame = CFrame.new(destinationPosition)
- else
- warn("Failed to teleport. Character or HumanoidRootPart not found.")
- end
- end
- -- Function to handle chat commands
- local function onChatted(message)
- local args = string.split(message, " ")
- local command = args[1]
- if command == ".teleport" or command == ".goto" then
- if #args ~= 3 then
- warn("Invalid format. Use: .teleport <me> <destination> or .goto <destination>")
- return
- end
- local targetName = args[2]
- local destinationName = args[3]
- if targetName ~= "me" and targetName ~= LocalPlayer.DisplayName and targetName ~= LocalPlayer.Name then
- warn("Target must be 'me', your display name, or your username.")
- return
- end
- local destinationPlayer = Players:FindFirstChild(destinationName)
- if not destinationPlayer then
- warn("Destination player not found: " .. destinationName)
- return
- end
- if LocalPlayer.Character and destinationPlayer.Character then
- local destinationPosition = destinationPlayer.Character.HumanoidRootPart.Position
- teleportPlayer(LocalPlayer.Character, destinationPosition)
- else
- warn("Failed to teleport. One of the players might not have a character loaded.")
- end
- elseif command == ".bring" then
- if #args ~= 2 then
- warn("Invalid format. Use: .bring <destination>")
- return
- end
- local destinationName = args[2]
- local destinationPlayer = Players:FindFirstChild(destinationName)
- if not destinationPlayer then
- warn("Destination player not found: " .. destinationName)
- return
- end
- if LocalPlayer.Character and destinationPlayer.Character then
- local localPlayerPosition = LocalPlayer.Character.HumanoidRootPart.Position
- teleportPlayer(destinationPlayer.Character, localPlayerPosition)
- else
- warn("Failed to bring. One of the players might not have a character loaded.")
- end
- elseif command == ".tpcoords" then
- if #args ~= 4 then
- warn("Invalid format. Use: .tpcoords <x> <y> <z>")
- return
- end
- local x = tonumber(args[2])
- local y = tonumber(args[3])
- local z = tonumber(args[4])
- if not x or not y or not z then
- warn("Invalid coordinates.")
- return
- end
- local destinationPosition = Vector3.new(x, y, z)
- if LocalPlayer.Character then
- teleportPlayer(LocalPlayer.Character, destinationPosition)
- else
- warn("Failed to teleport to coordinates. Character not loaded.")
- end
- elseif command == ".help" then
- print("Available commands:")
- print(".teleport <me> <destination> - Teleport yourself to another player")
- print(".goto <destination> - Teleport yourself to another player (alias for .teleport)")
- print(".bring <destination> - Bring another player to your position")
- print(".tpcoords <x> <y> <z> - Teleport yourself to specific coordinates")
- print(".help - Display this help message")
- else
- warn("Unknown command. Type .help for a list of commands.")
- end
- end
- LocalPlayer.Chatted:Connect(onChatted)
- -- Usage examples:
- -- In the chat, you can type:
- -- .teleport me DestinationPlayer
- -- .goto DestinationPlayer
- -- .bring DestinationPlayer
- -- .tpcoords 100 50 100
- -- .help
Advertisement
Add Comment
Please, Sign In to add comment