Advertisement
IfOnlyMyNameStillOn

heck

Feb 14th, 2020
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. local target = nil
  2.  
  3. local camera = workspace.CurrentCamera
  4. local plr = game.Players.LocalPlayer
  5.  
  6. local teamMates = {
  7.  
  8. }
  9.  
  10. --Add your team mates name in the brackets here
  11. --If it is more than one then have a coma on the end of all of them except the last one
  12.  
  13. --Example:
  14.  
  15. local teamMates = {
  16. 'Ultimate_Iifeform'
  17.  
  18. }
  19.  
  20. local input = game:GetService("UserInputService")
  21.  
  22. local on = false
  23.  
  24. function find(plr)
  25. for _,v in pairs(teamMates) do
  26. if tostring(v) == plr.Name then return true end
  27. end
  28. return false
  29. end
  30.  
  31. local hum = plr.Character.HumanoidRootPart
  32.  
  33. local findNear = function()
  34. local near, cur = 0, nil
  35. for _,v in pairs(game.Players:GetPlayers()) do
  36. if v.Character and plr.Character and not find(v) then
  37. 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
  38. near = (v.Character.Head.Position-plr.Character.Head.Position).magnitude
  39. print(v.Name)
  40. cur = v.Character.Head
  41. end
  42. end
  43. end
  44. return cur
  45. end
  46.  
  47. input.InputBegan:connect(function(input, func)
  48. if not func then
  49. if input.UserInputType == Enum.UserInputType.MouseButton2 then
  50. target = findNear()
  51. elseif input.KeyCode == Enum.KeyCode.X then
  52. on = not on
  53. end
  54. end
  55. end)
  56.  
  57. input.InputEnded:connect(function(input, func)
  58. if not func then
  59. if input.UserInputType == Enum.UserInputType.MouseButton2 then
  60. target = nil
  61. end
  62. end
  63. end)
  64.  
  65. game["Run Service"].RenderStepped:connect(function()
  66. if target and on then
  67. print('found')
  68. camera.CFrame = CFrame.new(camera.CFrame.Position, target.Position)
  69. hum.CFrame = CFrame.new(hum.Position, Vector3.new(target.Position.X,hum.Position.Y,target.Position.Z))
  70. end
  71. end)
  72.  
  73. print('ran!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement