Advertisement
koolusername

CTRL click tp

Jan 25th, 2020
50,244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. --[[local Plr = game:GetService("Players").LocalPlayer
  2. local Mouse = Plr:GetMouse()
  3.  
  4. Mouse.Button1Down:connect(function()
  5. if not game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.LeftControl) then return end
  6. if not Mouse.Target then return end
  7. Plr.Character:MoveTo(Mouse.Hit.p)
  8. end)
  9. --]]
  10. game:GetService("StarterGui"):SetCore("SendNotification",{
  11. Title = "CTRL click tp",
  12. Text = "Hold Ctrl then press click to a place you want to teleport to.",
  13. Duration = 6,
  14. })
  15. local speed = 100 -- set this lower to make it slower
  16. local bodyvelocityenabled = true -- set this to false if you are getting kicked
  17.  
  18. local Imput = game:GetService("UserInputService")
  19. local Plr = game.Players.LocalPlayer
  20. local Mouse = Plr:GetMouse()
  21.  
  22. function To(position)
  23. local Chr = Plr.Character
  24. if Chr ~= nil then
  25. local ts = game:GetService("TweenService")
  26. local char = game.Players.LocalPlayer.Character
  27. local hm = char.HumanoidRootPart
  28. local dist = (hm.Position - Mouse.Hit.p).magnitude
  29. local tweenspeed = dist/tonumber(speed)
  30. local ti = TweenInfo.new(tonumber(tweenspeed), Enum.EasingStyle.Linear)
  31. local tp = {CFrame = CFrame.new(position)}
  32. ts:Create(hm, ti, tp):Play()
  33. if bodyvelocityenabled == true then
  34. local bv = Instance.new("BodyVelocity")
  35. bv.Parent = hm
  36. bv.MaxForce = Vector3.new(100000,100000,100000)
  37. bv.Velocity = Vector3.new(0,0,0)
  38. wait(tonumber(tweenspeed))
  39. bv:Destroy()
  40. end
  41. end
  42. end
  43.  
  44. Imput.InputBegan:Connect(function(input)
  45. if input.UserInputType == Enum.UserInputType.MouseButton1 and Imput:IsKeyDown(Enum.KeyCode.LeftControl) then
  46. To(Mouse.Hit.p)
  47. end
  48. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement