Advertisement
TheUnknownDiscord

camera

Sep 6th, 2021 (edited)
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. local part1 = Instance.new("Part", game.Workspace)
  2. local part6 = Instance.new("Part", part1)
  3. part6.Size = Vector3.new(0.1,0.1,0.1)
  4. part6.Transparency = 1
  5. part6.CanCollide = false
  6. local weld = Instance.new("Weld", part6)
  7. weld.Part0 = part1
  8. weld.Part1 = partl6
  9. part6.CFrame = CFrame.new(0,0,1.5)
  10. local part4 = Instance.new("Part", game.Workspace)
  11. local part3 = Instance.new("Part", game.Workspace)
  12. local part5 = Instance.new("Part", game.Workspace)
  13. part1.Size = Vector3.new(1.487, 0.985, 2.72)
  14. part5.Size = Vector3.new(1.5, 1.5, 1.5)
  15. part1.Transparency = 1
  16. part5.Transparency = 1
  17. part4.Size = Vector3.new(1.487, 0.985, 2.72)
  18. Meshlol = Instance.new("SpecialMesh")
  19. Meshlol.Parent = part4
  20. Meshlol.MeshId = "http://www.roblox.com/asset/?id=2540334246"
  21. Meshlol.TextureId = "http://www.roblox.com/asset/?id=2540334261"
  22. Meshlol.Scale = Vector3.new(1, 1, 1)
  23. Meshlol2 = Instance.new("SpecialMesh")
  24. Meshlol2.Parent = part3
  25. Meshlol2.MeshId = "http://www.roblox.com/asset/?id=2540333861"
  26. Meshlol2.TextureId = "http://www.roblox.com/asset/?id=2540333887"
  27. Meshlol2.Scale = Vector3.new(1, 1, 1)
  28. part3.Size = Vector3.new(1.03, 1.044, 1.185)
  29. part3.CanCollide = false
  30. part1.Position = Vector3.new(10, 10, 10)
  31. part5.CanCollide = false
  32. part5.Anchored = true
  33. part5.Position = Vector3.new(10, 10, 10)
  34. Weld4 = Instance.new("Weld")
  35. Weld4.Parent = part1
  36. Weld4.Part0 = part1
  37. Weld4.Part1 = part4
  38. Weld4.part1 = part4
  39. local bg = Instance.new("BodyGyro",part1)
  40. bg.D = 100
  41. bg.P = 10000
  42. bg.MaxTorque = Vector3.new(400000, 400000, 400000)
  43. local bg2 = Instance.new("BodyGyro",part3)
  44. bg2.D = 100
  45. bg2.P = 10000
  46. bg2.MaxTorque = Vector3.new(0, 400000, 0)
  47. local bp = Instance.new("BodyPosition",part1)
  48. bp.D = 100
  49. bp.P = 10000
  50. bp.position = Vector3.new(10, 10, 10)
  51. local bp2 = Instance.new("BodyPosition",part3)
  52. bp2.D = 100
  53. bp2.P = 10000
  54. bp2.position = Vector3.new(10,9.25,10)
  55. part3.Position = Vector3.new(10,9.25,10)
  56. wait(0.1)
  57. part3.CFrame = part3.CFrame * CFrame.Angles(math.rad(180), 0, 0)
  58.  
  59. function move(target)
  60. local dir = (part5.Position - target.Position).unit
  61. local spawnPos = part5.Position
  62. local pos = spawnPos + (dir * 1)
  63. bg.cframe = CFrame.new(pos, pos + dir)
  64. bg2.cframe = CFrame.new(pos, pos + dir)
  65. end
  66.  
  67. function findNearestTorso(pos)
  68. local list = game.Workspace:GetChildren()
  69. local torso = nil
  70. local dist = 1000
  71. local temp = nil
  72. local human = nil
  73. local temp2 = nil
  74. for x = 1, #list do
  75. temp2 = list[x]
  76. if (temp2.className == "Model") and (temp2 ~= script.Parent) then
  77. temp = temp2:findFirstChild("Head")
  78. human = temp2:findFirstChild("Humanoid")
  79. if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
  80. if (temp.Position - pos).magnitude < dist then
  81. torso = temp
  82. dist = (temp.Position - pos).magnitude
  83. end
  84. end
  85. end
  86. end
  87. return torso
  88. end
  89. while true do
  90. local torso = findNearestTorso(part5.Position)
  91. if torso~=nil then
  92. move(torso)
  93. end
  94. task.wait()
  95. end
  96.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement