Advertisement
Ubicast

Click + Hold Key To Teleport Script | ROBLOX

Nov 21st, 2020
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.52 KB | None | 0 0
  1. local UserInputService = game:GetService("UserInputService")
  2. local Player = game.Players.LocalPlayer
  3. local Mouse = Player:GetMouse()
  4. local Key = Enum.KeyCode.LeftControl
  5.  
  6. function GetCharacter()
  7.     return Player.Character
  8. end
  9.  
  10. function Teleport(Position)
  11.     local Char = GetCharacter()
  12.  
  13.     if Char then
  14.         Char:MoveTo(Position)
  15.     end
  16. end
  17.  
  18. UserInputService.InputBegan:Connect(function(Input)
  19.     if Input.UserInputType == Enum.UserInputType.MouseButton1 and UserInputService:IsKeyDown(Key) then
  20.         Teleport(Mouse.Hit.p)
  21.     end
  22. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement