Advertisement
WagnerJunio07

Body Guards FE

Feb 7th, 2019
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.30 KB | None | 0 0
  1. -- This script has been converted to FE by iPxter
  2.  
  3.  
  4. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  5. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  6. do
  7. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  8. script.Parent = Player.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent and t.Function then
  34. t.Function(...)
  35. end
  36. end
  37. m.TrigEvent = te
  38. UIS.TrigEvent = te
  39.  
  40. Event.OnServerEvent:Connect(function(plr,io)
  41. if plr~=Player then return end
  42. if io.isMouse then
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. else
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. for _,t in pairs(CAS.Actions) do
  51. for _,k in pairs(t.Keys) do
  52. if k==io.KeyCode then
  53. t.Function(t.Name,io.UserInputState,io)
  54. end
  55. end
  56. end
  57. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  58. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  59. end
  60. end)
  61. Event.Parent = NLS([==[
  62. local Player = game:GetService("Players").LocalPlayer
  63. local Event = script:WaitForChild("UserInput_Event")
  64.  
  65. local UIS = game:GetService("UserInputService")
  66. local input = function(io,a)
  67. if a then return end
  68. --Since InputObject is a client-side instance, we create and pass table instead
  69. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  70. end
  71. UIS.InputBegan:Connect(input)
  72. UIS.InputEnded:Connect(input)
  73.  
  74. local Mouse = Player:GetMouse()
  75. local h,t
  76. --Give the server mouse data 30 times every second, but only if the values changed
  77. --If player is not moving their mouse, client won't fire events
  78. while wait(1/30) do
  79. if h~=Mouse.Hit or t~=Mouse.Target then
  80. h,t=Mouse.Hit,Mouse.Target
  81. Event:FireServer({isMouse=true,Target=t,Hit=h})
  82. end
  83. end]==],Player.Character)
  84. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  85. end
  86.  
  87. -- Location: Players.Cronizete.Character.BODYGUARDSV2
  88. -- Synapse Decompiler
  89. -- Purchase Here: https://brack4712.xyz/synapse/purchase
  90.  
  91. --// Controls
  92. --// X = Summon a bodyguard
  93. --// M = Change Types of bodyguards (Snipers, riflers) Sniper is the default
  94. --// Q = Aim
  95. --// C = Makes all the bodyguards disappear.
  96. --// Click = Shoot (You have to aim at somebody for snipers, you don't have to for the rifles)
  97.  
  98. plr = owner
  99. char = plr.Character
  100.  
  101. --// Anti double
  102. script.Name = "BODYGUARDSV2_TEMP"
  103. for _, a in pairs(char:GetDescendants()) do
  104. if a.Name == "BODYGUARDSV2" then
  105. a:Destroy()
  106. elseif a.Name == "" then
  107. a:Destroy()
  108. end
  109. end
  110. script.Name = "BODYGUARDSV2"
  111. --// Main Script
  112.  
  113. head = char.Head
  114. sam = 0
  115. char.Archivable = true
  116. arms = nil
  117. torso = nil
  118. follow = false
  119. current = nil
  120. curfollow = nil
  121. rifleshoot = false
  122. targ, huma = nil,nil
  123.  
  124. --// points
  125. point1 = Instance.new('Part', char)
  126. point1.Anchored = false
  127. point1.CanCollide = false
  128. point1.Transparency = 1
  129. point1.Size = Vector3.new(0.2,0.2,0.2)
  130.  
  131. Weld = Instance.new("Weld",game.Players.LocalPlayer.Character)
  132. Weld.Part0 = game.Players.LocalPlayer.Character["Torso"]
  133. Weld.Part1 = point1
  134. Weld.C1 = CFrame.new(10, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
  135.  
  136. point2 = Instance.new('Part', char)
  137. point2.Anchored = false
  138. point2.CanCollide = false
  139. point2.Transparency = 1
  140. point2.Size = Vector3.new(0.2,0.2,0.2)
  141.  
  142. Weld = Instance.new("Weld",game.Players.LocalPlayer.Character)
  143. Weld.Part0 = game.Players.LocalPlayer.Character["Torso"]
  144. Weld.Part1 = point2
  145. Weld.C1 = CFrame.new(-10, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
  146. --// points
  147.  
  148. --// Configuration
  149.  
  150. max = 15
  151. max1 = 2
  152. maxammo = 30
  153. mode = "Snipers"
  154.  
  155. --//
  156.  
  157. snipers,riflers,welds = {},{},{}
  158.  
  159. skinc = {
  160. 'Rust',
  161. 'Cool yellow',
  162. 'Br. yellowish orange',
  163. 'Pastel yellow',
  164. 'CGA brown'
  165. }
  166.  
  167. props = {
  168. 'HeadColor',
  169. 'LeftArmColor',
  170. 'RightArmColor',
  171. 'TorsoColor',
  172. 'RightLegColor',
  173. 'LeftLegColor'
  174. }
  175.  
  176. snpr = char:Clone()
  177. snpr.Name = ""
  178.  
  179. for _, a in pairs(snpr:children()) do
  180. if a:IsA'CharacterMesh' or a:IsA'Accessory' or a:IsA'Shirt' or a:IsA'Pants' then
  181. a:Destroy()
  182. end
  183. end
  184.  
  185. snpr.Parent = nil
  186.  
  187. bg = Instance.new("BodyGyro", snpr.HumanoidRootPart)
  188. bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  189. bg.Name = "FOLLOW"
  190. bg.P = 10000
  191. bg.D = 100
  192.  
  193. sfx = Instance.new('Sound', snpr.Head)
  194. sfx.SoundId = "rbxassetid://740599871"
  195. sfx.Volume = 3
  196. sfx2 = Instance.new('Sound', snpr)
  197. sfx2.Name = "SNIPERSOUND"
  198. sfx2.SoundId = "rbxassetid://136523485"
  199. sfx2.Volume = 3
  200.  
  201. lazor = Instance.new('Part', snpr)
  202. lazor.Name = "Laser"
  203. lazor.Anchored = true
  204. lazor.Shape = Enum.PartType.Ball
  205. lazor.Size = Vector3.new(0.3,0.3,0.3)
  206. lazor.BrickColor = BrickColor.new('Really red')
  207. lazor.Transparency = 0.4
  208. lazor.CanCollide = false
  209.  
  210. shirt = Instance.new('Shirt', snpr)
  211. shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=139465409"
  212. pants = Instance.new('Pants', snpr)
  213. pants.PantsTemplate = "http://www.roblox.com/asset/?id=139466214"
  214. ----------------------------------------------------------------
  215. hat = Instance.new('Part', snpr)
  216. hat.Name = 'Hat'
  217. hat.Anchored = false
  218. hat.CanCollide = false
  219. mesh = Instance.new('SpecialMesh', hat)
  220. mesh.MeshId = "http://www.roblox.com/asset/?id=31152467"
  221. mesh.TextureId = "http://www.roblox.com/asset/?id=32002857"
  222. mesh.Scale = Vector3.new(1,1,1)
  223. weld = Instance.new('Weld', hat)
  224. weld.Part0 = hat
  225. weld.Part1 = snpr.Head
  226. weld.C0 = CFrame.new(0,-0.2,0)
  227. --------------------------------------------
  228. sniper = Instance.new('Part', snpr)
  229. sniper.Anchored = false
  230. sniper.CanCollide = false
  231. sniper.Name = "Sniper"
  232. sniper.Size = Vector3.new(7.88, 1.77, 1)
  233. mesh = Instance.new('SpecialMesh', sniper)
  234. mesh.MeshId = "rbxassetid://462309398"
  235. mesh.TextureId = "rbxassetid://462309404"
  236. mesh.Scale = Vector3.new(0.006, 0.006, 0.006)
  237. weld = Instance.new('Weld', sniper)
  238. weld.Part0 = sniper
  239. weld.Part1 = snpr.Head
  240. weld.C0 = CFrame.new(-2,0.5,-0.2) * CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))
  241.  
  242. arms = {snpr:FindFirstChild("Left Arm"), snpr:FindFirstChild("Right Arm")}
  243. torso = snpr:FindFirstChild("Torso")
  244.  
  245. if arms ~= nil and torso ~= nil then
  246. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  247. if sh ~= nil then
  248. local yes = true
  249. if yes then
  250. yes = false
  251. sh[1].Part1 = nil
  252. sh[2].Part1 = nil
  253. local weld1 = Instance.new("Weld")
  254. weld1.Part0 = torso
  255. weld1.Parent = torso
  256. weld1.Part1 = arms[1]
  257. weld1.C1 = CFrame.new(-0.249, 1.35, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
  258. welds[1] = weld1
  259. local weld2 = Instance.new("Weld")
  260. weld2.Part0 = torso
  261. weld2.Parent = torso
  262. weld2.Part1 = arms[2]
  263. weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  264. welds[2] = weld2
  265. end
  266. end
  267. end
  268.  
  269. function sniper(pos)
  270. if sam <= max - 1 then
  271. local sniper = snpr:Clone()
  272. local bodyc = sniper:FindFirstChildOfClass'BodyColors'
  273. local skincolor = skinc[math.random(1,5)]
  274.  
  275. for _, a in pairs(props) do
  276. bodyc[a] = BrickColor.new(skincolor)
  277. end
  278.  
  279. sniper.Parent = char
  280. sniper:MoveTo(pos)
  281. sniper.Torso.CFrame = CFrame.new(sniper.Torso.Position, head.Position)
  282. table.insert(snipers, sniper)
  283. sam = sam + 1
  284. end
  285. end
  286.  
  287. function rifler(pos)
  288. if sam <= max1 - 1 then
  289. local rifler = snpr:Clone()
  290. local bodyc = rifler:FindFirstChildOfClass'BodyColors'
  291. local skincolor = skinc[math.random(1,5)]
  292.  
  293. for _, a in pairs(props) do
  294. bodyc[a] = BrickColor.new(skincolor)
  295. end
  296.  
  297. for _, a in pairs(rifler:GetDescendants()) do
  298. if a:IsA'BodyGyro' then
  299. a:Destroy()
  300. end
  301. end
  302.  
  303. rifler.Parent = char
  304. rifler:MoveTo(pos)
  305. rifler.Torso.CFrame = CFrame.new(rifler.Torso.Position, head.Position)
  306. rifler:FindFirstChild'SNIPERSOUND'.Pitch = 1.2
  307. rifle = rifler:FindFirstChild'Sniper'
  308. rifle.Name = "Rifle"
  309. rifle:FindFirstChildOfClass'SpecialMesh'.TextureId = "rbxassetid://546505949"
  310. rifle:FindFirstChildOfClass'SpecialMesh'.MeshId = "rbxassetid://546505802"
  311. rifle:FindFirstChildOfClass'SpecialMesh'.Scale = Vector3.new(0.2, 0.2, 0.2)
  312. rifle:FindFirstChildOfClass'Weld'.C0 = CFrame.new(-.4,.6,1.6) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))
  313. table.insert(riflers, rifler)
  314. sam = sam + 1
  315. end
  316. end
  317.  
  318. function ray(a,b)
  319. local ray = Ray.new(a.CFrame.p, (b - a.CFrame.p).unit * 700)
  320. local part, position = workspace:FindPartOnRay(ray, char, false, true)
  321.  
  322. local beam = Instance.new("Part", workspace)
  323. beam.FormFactor = "Custom"
  324. beam.Material = "Plastic"
  325. beam.Transparency = 0.25
  326. beam.Anchored = true
  327. beam.Locked = true
  328. beam.CanCollide = false
  329. beam.BrickColor = BrickColor.new('Really black')
  330.  
  331. local distance = (a.CFrame.p - position).magnitude
  332. beam.Size = Vector3.new(0.08, 0.08, distance)
  333. beam.CFrame = CFrame.new(a.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
  334.  
  335. game:GetService('Debris'):AddItem(beam, 0.1)
  336. end
  337.  
  338. mouse.KeyDown:connect(function(k)
  339. local key = k:lower()
  340. if key == "x" then
  341. follow = false
  342. if mode == "Snipers" then
  343. sniper(mouse.Hit.p)
  344. elseif mode == "Riflers" then
  345. rifler(mouse.Hit.p)
  346. end
  347. wait(.3)
  348. if curfollow then
  349. follow = true
  350. elseif not curfollow then
  351. follow = false
  352. end
  353. elseif key == "c" then
  354. for _, a in pairs(char:children()) do
  355. if a.Name == "" then
  356. for i = 1,10 do
  357. a:FindFirstChild'HumanoidRootPart'.CFrame = a:FindFirstChild'HumanoidRootPart'.CFrame * CFrame.new(0,-i + 0.8,0)
  358. wait()
  359. end
  360. wait(.15)
  361. a:Destroy()
  362. sam = sam - 1
  363. end
  364. end
  365. elseif key == "m" then
  366. if mode == "Snipers" then
  367. mode = "Riflers"
  368. elseif mode == "Riflers" then
  369. mode = "Snipers"
  370. end
  371. elseif key == "q" then
  372. if not follow then
  373. follow = true
  374. curfollow = true
  375. on = false
  376. for i = 1, sam / 2 do
  377. wait(.6)
  378. local now
  379. ypcall(function()
  380. if mode == "Snipers" then
  381. now = snipers[math.random(1,#snipers)]
  382. elseif mode == "Riflers" then
  383. now = riflers[math.random(1,#riflers)]
  384. end
  385. end)
  386. for _, a in pairs(riflers) do
  387. bg = Instance.new("BodyGyro", a.HumanoidRootPart)
  388. bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  389. bg.Name = "FOLLOW"
  390. bg.P = 10000
  391. bg.D = 100
  392. end
  393. now.Head.Sound:Resume()
  394. current = now.Head.Sound.SoundId
  395. end
  396. elseif follow then
  397. for _, a in pairs(riflers) do
  398. for _, b in pairs(a:GetDescendants()) do
  399. if b:IsA'BodyGyro' then
  400. b:Destroy()
  401. end
  402. end
  403. end
  404. follow = false
  405. curfollow = false
  406. end
  407. end
  408. end)
  409.  
  410. mouse.Button1Down:connect(function()
  411. if follow and mode ~= "Riflers" and mouse.Target and mouse.Target.Parent and mouse.Target.Parent:FindFirstChildOfClass'Humanoid' then
  412. follow = false
  413. local targ = mouse.Target
  414. huma = targ.Parent:FindFirstChildOfClass'Humanoid'
  415. for _, a in pairs(targ.Parent:children()) do
  416. if a:IsA'ForceField' then
  417. a:Destroy()
  418. end
  419. end
  420. huma.MaxHealth = 100
  421. huma.Name = "Humanoid"
  422. if mode == "Snipers" then
  423. for _, a in pairs(snipers) do
  424. if a:FindFirstChild'HumanoidRootPart' then
  425. wait(.2)
  426. rootpart = a.HumanoidRootPart
  427. snd = rootpart.Parent:FindFirstChild'SNIPERSOUND'
  428. snd:Play()
  429. ray(a:FindFirstChild'Sniper',targ.Parent.Head.Position)
  430. huma:TakeDamage(huma.MaxHealth/2/2/2)
  431. end
  432. end
  433. follow = true
  434. end
  435. end
  436. end)
  437.  
  438. mouse.Button1Down:connect(function()
  439. if mode == "Riflers" then
  440. rifleshoot = true
  441. end
  442. end)
  443.  
  444. mouse.Button1Up:connect(function()
  445. if mode == "Riflers" then
  446. rifleshoot = false
  447. end
  448. end)
  449.  
  450. while wait() do
  451. ypcall(function()
  452. riflers[1]:FindFirstChildOfClass'Humanoid':MoveTo(point1.Position)
  453. riflers[2]:FindFirstChildOfClass'Humanoid':MoveTo(point2.Position)
  454. end)
  455. if follow then
  456. if mode == "Snipers" then
  457. for _, a in pairs(snipers) do
  458. if a:FindFirstChild'HumanoidRootPart' then
  459. rootpart = a.HumanoidRootPart
  460. rootpart.FOLLOW.CFrame = CFrame.new(rootpart.Position, mouse.Hit.p * Vector3.new(1,0,1) + rootpart.Position * Vector3.new(0,1,0))
  461. rootpart.Parent:WaitForChild'Laser'.CFrame = mouse.Hit
  462. end
  463. end
  464. elseif mode == "Riflers" then
  465. for _, a in pairs(riflers) do
  466. if a:FindFirstChild'HumanoidRootPart' then
  467. rootpart = a.HumanoidRootPart
  468. 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)
  469. rootpart.Parent:WaitForChild'Laser'.CFrame = mouse.Hit
  470. end
  471. end
  472. end
  473. end
  474. if rifleshoot and follow and mouse.Target and mouse.Target.Parent then
  475. local targ = mouse.Target
  476. local huma = nil
  477. if targ.Parent:FindFirstChildOfClass'Humanoid' then
  478. huma = targ.Parent:FindFirstChildOfClass'Humanoid'
  479. else
  480. huma = nil
  481. end
  482. if huma ~= nil then
  483. for _, a in pairs(riflers) do
  484. if a:FindFirstChild'HumanoidRootPart' and huma.Health ~= 0 then
  485. wait(.02)
  486. rootpart = a.HumanoidRootPart
  487. snd = rootpart.Parent:FindFirstChild'SNIPERSOUND'
  488. snd.Pitch = 80
  489. snd:Resume()
  490. ray(a:FindFirstChild'Rifle',targ.Parent.Head.Position)
  491. huma:TakeDamage(huma.MaxHealth/2/2/2/2/2)
  492. end
  493. end
  494. else
  495. for _, a in pairs(riflers) do
  496. snd = rootpart.Parent:FindFirstChild'SNIPERSOUND'
  497. snd.Pitch = 80
  498. snd:Resume()
  499. ray(a:FindFirstChild'Rifle',mouse.Hit.p)
  500. end
  501. end
  502. end
  503. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement