Advertisement
ILovePotato

Untitled

Nov 29th, 2024
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. -- Create the tool
  2. local tool = Instance.new("Tool")
  3. tool.Name = "TELEPORT TOOL"
  4. tool.RequiresHandle = false
  5. tool.ToolTip = "Teleport with clicking on the ground"
  6. tool.Parent = game.Players.LocalPlayer.Backpack
  7.  
  8. -- Handle Mouse Click
  9. tool.Activated:Connect(function()
  10. local player = game.Players.LocalPlayer
  11. local mouse = player:GetMouse()
  12.  
  13. -- Wait for a click
  14. mouse.Button1Down:Connect(function()
  15. if not tool.Enabled then return end -- Ensure the tool is enabled
  16. tool.Enabled = false -- Disable temporarily to avoid spamming
  17.  
  18. local target = mouse.Hit.Position -- Get the position of the click
  19.  
  20. -- Teleport the character to the clicked position
  21. if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
  22. player.Character.HumanoidRootPart.CFrame = CFrame.new(target + Vector3.new(0, 3, 0)) -- Offset slightly above ground
  23. end
  24.  
  25. -- Re-enable the tool after a short delay
  26. task.wait(0.2)
  27. tool.Enabled = true
  28. end)
  29. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement