Advertisement
VoidScript

Solider test1

May 28th, 2018
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.27 KB | None | 0 0
  1. --Edited by BiteMode
  2. --// Controls
  3. --// X = Summon a bodyguard
  4. --// M = Change Types of bodyguards (Snipers, riflers) Sniper is the default
  5. --// Q = Aim
  6. --// C = Makes all the bodyguards disappear.
  7. --// Click = Shoot (You have to aim at somebody for snipers, you don't have to for the rifles)
  8.  
  9. plr = game:service'Players'.LocalPlayer
  10. char = plr.Character
  11.  
  12. --// Anti double
  13. script.Name = "BODYGUARDSV2_TEMP"
  14. for _, a in pairs(char:GetDescendants()) do
  15. if a.Name == "BODYGUARDSV2" then
  16. a:Destroy()
  17. elseif a.Name == "" then
  18. a:Destroy()
  19. end
  20. end
  21. script.Name = "BODYGUARDSV2"
  22. --// Main Script
  23.  
  24. head = char.Head
  25. mouse = plr:GetMouse()
  26. sam = 0
  27. char.Archivable = true
  28. arms = nil
  29. torso = nil
  30. follow = false
  31. current = nil
  32. curfollow = nil
  33. rifleshoot = false
  34. targ, huma = nil,nil
  35.  
  36. --// points
  37. point1 = Instance.new('Part', char)
  38. point1.Anchored = false
  39. point1.CanCollide = false
  40. point1.Transparency = 1
  41. point1.Size = Vector3.new(0.2,0.2,0.2)
  42.  
  43. Weld = Instance.new("Weld",game.Players.LocalPlayer.Character)
  44. Weld.Part0 = game.Players.LocalPlayer.Character["Torso"]
  45. Weld.Part1 = point1
  46. Weld.C1 = CFrame.new(10, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
  47.  
  48. point2 = Instance.new('Part', char)
  49. point2.Anchored = false
  50. point2.CanCollide = false
  51. point2.Transparency = 1
  52. point2.Size = Vector3.new(0.2,0.2,0.2)
  53.  
  54. Weld = Instance.new("Weld",game.Players.LocalPlayer.Character)
  55. Weld.Part0 = game.Players.LocalPlayer.Character["Torso"]
  56. Weld.Part1 = point2
  57. Weld.C1 = CFrame.new(-10, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
  58. --// points
  59.  
  60. --// Configuration
  61.  
  62. max = 50
  63. max1 = 10
  64. maxammo = 50
  65. mode = "Snipers"
  66.  
  67. --//
  68.  
  69. snipers,riflers,welds = {},{},{}
  70.  
  71. skinc = {
  72. 'Pastel yellow',
  73. 'Pastel yellow',
  74. 'Pastel yellow',
  75. 'Pastel yellow',
  76. 'Pastel yellow'
  77. }
  78.  
  79. props = {
  80. 'HeadColor',
  81. 'LeftArmColor',
  82. 'RightArmColor',
  83. 'TorsoColor',
  84. 'RightLegColor',
  85. 'LeftLegColor'
  86. }
  87.  
  88. snpr = char:Clone()
  89. snpr.Name = ""
  90.  
  91. for _, a in pairs(snpr:children()) do
  92. if a:IsA'CharacterMesh' or a:IsA'Accessory' or a:IsA'Shirt' or a:IsA'Pants' then
  93. a:Destroy()
  94. end
  95. end
  96.  
  97. snpr.Parent = nil
  98.  
  99. bg = Instance.new("BodyGyro", snpr.HumanoidRootPart)
  100. bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  101. bg.Name = "FOLLOW"
  102. bg.P = 10000
  103. bg.D = 100
  104.  
  105. sfx = Instance.new('Sound', snpr.Head)
  106. sfx.SoundId = "rbxassetid://740599871"
  107. sfx.Volume = 3
  108. sfx2 = Instance.new('Sound', snpr)
  109. sfx2.Name = "SNIPERSOUND"
  110. sfx2.SoundId = "rbxassetid://136523485"
  111. sfx2.Volume = 3
  112.  
  113. lazor = Instance.new('Part', snpr)
  114. lazor.Name = "Laser"
  115. lazor.Anchored = true
  116. lazor.Shape = Enum.PartType.Ball
  117. lazor.Size = Vector3.new(0.3,0.3,0.3)
  118. lazor.BrickColor = BrickColor.new('Bright blue')
  119. lazor.Transparency = 0.4
  120. lazor.CanCollide = false
  121.  
  122. shirt = Instance.new('Shirt', snpr)
  123. shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=1161784003"
  124. pants = Instance.new('Pants', snpr)
  125. pants.PantsTemplate = "http://www.roblox.com/asset/?id=1161784003"
  126. ----------------------------------------------------------------
  127. hat = Instance.new('Part', snpr)
  128. hat.Name = 'Hat'
  129. hat.Anchored = false
  130. hat.CanCollide = false
  131. mesh = Instance.new('SpecialMesh', hat)
  132. mesh.MeshId = "http://www.roblox.com/asset/?id=111898512"
  133. mesh.TextureId = "http://www.roblox.com/asset/?id=111898570"
  134. mesh.Scale = Vector3.new(1,1,1)
  135. weld = Instance.new('Weld', hat)
  136. weld.Part0 = hat
  137. weld.Part1 = snpr.Head
  138. weld.C0 = CFrame.new(0,-0.4,0)
  139. --------------------------------------------
  140. sniper = Instance.new('Part', snpr)
  141. sniper.Anchored = false
  142. sniper.CanCollide = false
  143. sniper.Name = "Sniper"
  144. sniper.Size = Vector3.new(7.88, 1.77, 1)
  145. mesh = Instance.new('SpecialMesh', sniper)
  146. mesh.MeshId = "rbxassetid://462309398"
  147. mesh.TextureId = "rbxassetid://462309404"
  148. mesh.Scale = Vector3.new(0.006, 0.006, 0.006)
  149. weld = Instance.new('Weld', sniper)
  150. weld.Part0 = sniper
  151. weld.Part1 = snpr.Head
  152. weld.C0 = CFrame.new(-2,0.5,-0.2) * CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))
  153.  
  154. arms = {snpr:FindFirstChild("Left Arm"), snpr:FindFirstChild("Right Arm")}
  155. torso = snpr:FindFirstChild("Torso")
  156.  
  157. if arms ~= nil and torso ~= nil then
  158. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  159. if sh ~= nil then
  160. local yes = true
  161. if yes then
  162. yes = false
  163. sh[1].Part1 = nil
  164. sh[2].Part1 = nil
  165. local weld1 = Instance.new("Weld")
  166. weld1.Part0 = torso
  167. weld1.Parent = torso
  168. weld1.Part1 = arms[1]
  169. weld1.C1 = CFrame.new(-0.249, 1.35, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
  170. welds[1] = weld1
  171. local weld2 = Instance.new("Weld")
  172. weld2.Part0 = torso
  173. weld2.Parent = torso
  174. weld2.Part1 = arms[2]
  175. weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  176. welds[2] = weld2
  177. end
  178. end
  179. end
  180.  
  181. function sniper(pos)
  182. if sam <= max - 1 then
  183. local sniper = snpr:Clone()
  184. local bodyc = sniper:FindFirstChildOfClass'BodyColors'
  185. local skincolor = skinc[math.random(1,5)]
  186.  
  187. for _, a in pairs(props) do
  188. bodyc[a] = BrickColor.new(skincolor)
  189. end
  190.  
  191. sniper.Parent = char
  192. sniper:MoveTo(pos)
  193. sniper.Torso.CFrame = CFrame.new(sniper.Torso.Position, head.Position)
  194. table.insert(snipers, sniper)
  195. sam = sam + 1
  196. end
  197. end
  198.  
  199. function rifler(pos)
  200. if sam <= max1 - 1 then
  201. local rifler = snpr:Clone()
  202. local bodyc = rifler:FindFirstChildOfClass'BodyColors'
  203. local skincolor = skinc[math.random(1,5)]
  204.  
  205. for _, a in pairs(props) do
  206. bodyc[a] = BrickColor.new(skincolor)
  207. end
  208.  
  209. for _, a in pairs(rifler:GetDescendants()) do
  210. if a:IsA'BodyGyro' then
  211. a:Destroy()
  212. end
  213. end
  214.  
  215. rifler.Parent = char
  216. rifler:MoveTo(pos)
  217. rifler.Torso.CFrame = CFrame.new(rifler.Torso.Position, head.Position)
  218. rifler:FindFirstChild'SNIPERSOUND'.Pitch = 1.2
  219. rifle = rifler:FindFirstChild'Sniper'
  220. rifle.Name = "Rifle"
  221. rifle:FindFirstChildOfClass'SpecialMesh'.TextureId = "rbxassetid://546505949"
  222. rifle:FindFirstChildOfClass'SpecialMesh'.MeshId = "rbxassetid://546505802"
  223. rifle:FindFirstChildOfClass'SpecialMesh'.Scale = Vector3.new(0.2, 0.2, 0.2)
  224. rifle:FindFirstChildOfClass'Weld'.C0 = CFrame.new(-.4,.6,1.6) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))
  225. table.insert(riflers, rifler)
  226. sam = sam + 1
  227. end
  228. end
  229.  
  230. function ray(a,b)
  231. local ray = Ray.new(a.CFrame.p, (b - a.CFrame.p).unit * 700)
  232. local part, position = workspace:FindPartOnRay(ray, char, false, true)
  233.  
  234. local beam = Instance.new("Part", workspace)
  235. beam.FormFactor = "Custom"
  236. beam.Material = "Plastic"
  237. beam.Transparency = 0.25
  238. beam.Anchored = true
  239. beam.Locked = true
  240. beam.CanCollide = false
  241. beam.BrickColor = BrickColor.new('Really black')
  242.  
  243. local distance = (a.CFrame.p - position).magnitude
  244. beam.Size = Vector3.new(0.08, 0.08, distance)
  245. beam.CFrame = CFrame.new(a.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
  246.  
  247. game:GetService('Debris'):AddItem(beam, 0.1)
  248. end
  249.  
  250. mouse.KeyDown:connect(function(k)
  251. local key = k:lower()
  252. if key == "x" then
  253. follow = false
  254. if mode == "Snipers" then
  255. sniper(mouse.Hit.p)
  256. elseif mode == "Riflers" then
  257. rifler(mouse.Hit.p)
  258. end
  259. wait(.3)
  260. if curfollow then
  261. follow = true
  262. elseif not curfollow then
  263. follow = false
  264. end
  265. elseif key == "c" then
  266. for _, a in pairs(char:children()) do
  267. if a.Name == "" then
  268. for i = 1,10 do
  269. a:FindFirstChild'HumanoidRootPart'.CFrame = a:FindFirstChild'HumanoidRootPart'.CFrame * CFrame.new(0,-i + 0.8,0)
  270. wait()
  271. end
  272. wait(.15)
  273. a:Destroy()
  274. sam = sam - 1
  275. end
  276. end
  277. elseif key == "m" then
  278. if mode == "Snipers" then
  279. mode = "Riflers"
  280. elseif mode == "Riflers" then
  281. mode = "Snipers"
  282. end
  283. elseif key == "q" then
  284. if not follow then
  285. follow = true
  286. curfollow = true
  287. on = false
  288. for i = 1, sam / 2 do
  289. wait(.6)
  290. local now
  291. ypcall(function()
  292. if mode == "Snipers" then
  293. now = snipers[math.random(1,#snipers)]
  294. elseif mode == "Riflers" then
  295. now = riflers[math.random(1,#riflers)]
  296. end
  297. end)
  298. for _, a in pairs(riflers) do
  299. bg = Instance.new("BodyGyro", a.HumanoidRootPart)
  300. bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  301. bg.Name = "FOLLOW"
  302. bg.P = 10000
  303. bg.D = 100
  304. end
  305. now.Head.Sound:Resume()
  306. current = now.Head.Sound.SoundId
  307. end
  308. elseif follow then
  309. for _, a in pairs(riflers) do
  310. for _, b in pairs(a:GetDescendants()) do
  311. if b:IsA'BodyGyro' then
  312. b:Destroy()
  313. end
  314. end
  315. end
  316. follow = false
  317. curfollow = false
  318. end
  319. end
  320. end)
  321.  
  322. mouse.Button1Down:connect(function()
  323. if follow and mode ~= "Riflers" and mouse.Target and mouse.Target.Parent and mouse.Target.Parent:FindFirstChildOfClass'Humanoid' then
  324. follow = false
  325. local targ = mouse.Target
  326. huma = targ.Parent:FindFirstChildOfClass'Humanoid'
  327. for _, a in pairs(targ.Parent:children()) do
  328. if a:IsA'ForceField' then
  329. a:Destroy()
  330. end
  331. end
  332. huma.MaxHealth = 200
  333. huma.Name = "Humanoid"
  334. if mode == "Snipers" then
  335. for _, a in pairs(snipers) do
  336. if a:FindFirstChild'HumanoidRootPart' then
  337. wait(.2)
  338. rootpart = a.HumanoidRootPart
  339. snd = rootpart.Parent:FindFirstChild'SNIPERSOUND'
  340. snd:Play()
  341. ray(a:FindFirstChild'Sniper',targ.Parent.Head.Position)
  342. huma:TakeDamage(huma.MaxHealth/2/2/2)
  343. end
  344. end
  345. follow = true
  346. end
  347. end
  348. end)
  349.  
  350. mouse.Button1Down:connect(function()
  351. if mode == "Riflers" then
  352. rifleshoot = true
  353. end
  354. end)
  355.  
  356. mouse.Button1Up:connect(function()
  357. if mode == "Riflers" then
  358. rifleshoot = false
  359. end
  360. end)
  361.  
  362. while wait() do
  363. ypcall(function()
  364. riflers[1]:FindFirstChildOfClass'Humanoid':MoveTo(point1.Position)
  365. riflers[2]:FindFirstChildOfClass'Humanoid':MoveTo(point2.Position)
  366. end)
  367. if follow then
  368. if mode == "Snipers" then
  369. for _, a in pairs(snipers) do
  370. if a:FindFirstChild'HumanoidRootPart' then
  371. rootpart = a.HumanoidRootPart
  372. rootpart.FOLLOW.CFrame = CFrame.new(rootpart.Position, mouse.Hit.p * Vector3.new(1,0,1) + rootpart.Position * Vector3.new(0,1,0))
  373. rootpart.Parent:WaitForChild'Laser'.CFrame = mouse.Hit
  374. end
  375. end
  376. elseif mode == "Riflers" then
  377. for _, a in pairs(riflers) do
  378. if a:FindFirstChild'HumanoidRootPart' then
  379. rootpart = a.HumanoidRootPart
  380. ypcall(function() rootpart.FOLLOW.CFrame = CFrame.new(rootpart.Position, mouse.Hit.p * Vector3.new(1,0,1) + rootpart.Position * Vector3.new(0,1,0)) end)
  381. rootpart.Parent:WaitForChild'Laser'.CFrame = mouse.Hit
  382. end
  383. end
  384. end
  385. end
  386. if rifleshoot and follow and mouse.Target and mouse.Target.Parent then
  387. local targ = mouse.Target
  388. local huma = nil
  389. if targ.Parent:FindFirstChildOfClass'Humanoid' then
  390. huma = targ.Parent:FindFirstChildOfClass'Humanoid'
  391. else
  392. huma = nil
  393. end
  394. if huma ~= nil then
  395. for _, a in pairs(riflers) do
  396. if a:FindFirstChild'HumanoidRootPart' and huma.Health ~= 0 then
  397. wait(.02)
  398. rootpart = a.HumanoidRootPart
  399. snd = rootpart.Parent:FindFirstChild'SNIPERSOUND'
  400. snd.Pitch = 80
  401. snd:Resume()
  402. ray(a:FindFirstChild'Rifle',targ.Parent.Head.Position)
  403. huma:TakeDamage(huma.MaxHealth/2/2/2/2/2)
  404. end
  405. end
  406. else
  407. for _, a in pairs(riflers) do
  408. snd = rootpart.Parent:FindFirstChild'SNIPERSOUND'
  409. snd.Pitch = 80
  410. snd:Resume()
  411. ray(a:FindFirstChild'Rifle',mouse.Hit.p)
  412. end
  413. end
  414. end
  415. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement