Advertisement
qiell

teleport tool

Aug 15th, 2024
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. -- Teleport Tool Script
  2. local ToolName = "Advanced Teleport Tool"
  3.  
  4. local function createTool()
  5. -- Create the tool
  6. local tool = Instance.new("Tool")
  7. tool.Name = ToolName
  8. tool.RequiresHandle = false
  9. tool.CanBeDropped = false
  10.  
  11. -- Add the tool to the playerโ€™s backpack
  12. tool.Parent = game.Players.LocalPlayer.Backpack
  13.  
  14. -- Teleport on activation
  15. tool.Activated:Connect(function()
  16. local player = game.Players.LocalPlayer
  17. local mouse = player:GetMouse()
  18. local targetPos = mouse.Hit.p
  19.  
  20. -- Teleport the player to the mouse position
  21. player.Character:MoveTo(targetPos)
  22. end)
  23. end
  24.  
  25. -- Function to handle respawning the tool
  26. local function onCharacterAdded(character)
  27. createTool()
  28. end
  29.  
  30. -- Set up tool and handle respawning
  31. game.Players.LocalPlayer.CharacterAdded:Connect(onCharacterAdded)
  32. createTool()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement