Advertisement
Guest User

Untitled

a guest
Jan 5th, 2020
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. loadstring(game:HttpGetAsync('https://pastebin.com/raw/yFD4crSn'))()
  2. local target
  3.  
  4. local camera = workspace.CurrentCamera
  5. local plr = game.Players.LocalPlayer
  6.  
  7. local input = game:GetService("UserInputService")
  8.  
  9. local on = false
  10.  
  11. local hum = plr.Character.HumanoidRootPart
  12.  
  13. local findNear = function()
  14. local near, cur = 0, nil
  15. for _,v in pairs(game.Players:GetPlayers()) do
  16. if v.Character then
  17. if v.Name ~= plr.Name and (v.Character.Head.Position-plr.Character.Head.Position).magnitude < near or near == 0 and v.Name ~= plr.Name then
  18. near = (v.Character.Head.Position-plr.Character.Head.Position).magnitude
  19. cur = v.Character.Head
  20. end
  21. end
  22. end
  23. return cur
  24. end
  25.  
  26. input.InputBegan:connect(function(input, func)
  27. if not func then
  28. if input.UserInputType == Enum.UserInputType.MouseButton2 then
  29. target = findNear()
  30. elseif input.KeyCode == Enum.KeyCode.X then
  31. on = not on
  32. end
  33. end
  34. end)
  35.  
  36. input.InputEnded:connect(function(input, func)
  37. if not func then
  38. if input.UserInputType == Enum.UserInputType.MouseButton2 then
  39. target = nil
  40. end
  41. end
  42. end)
  43.  
  44. game["Run Service"].RenderStepped:connect(function()
  45. if target and on then
  46. print('found')
  47. camera.CFrame = CFrame.new(camera.CFrame.Position, target.Position)
  48. hum.CFrame = CFrame.new(hum.Position, Vector3.new(target.Position.X,hum.Position.Y,target.Position.Z))
  49. end
  50. end)
  51.  
  52. print('ran!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement