Advertisement
firebudgy

Untitled

May 27th, 2018
658
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.28 KB | None | 0 0
  1.  
  2. --Converted with ttyyuu12345's model to script plugin v4
  3. function sandbox(var,func)
  4. local env = getfenv(func)
  5. local newenv = setmetatable({},{
  6. __index = function(self,k)
  7. if k=="script" then
  8. return var
  9. else
  10. return env[k]
  11. end
  12. end,
  13. })
  14. setfenv(func,newenv)
  15. return func
  16. end
  17. cors = {}
  18. mas = Instance.new("Model",game:GetService("Lighting"))
  19. Tool0 = Instance.new("Tool")
  20. Part1 = Instance.new("Part")
  21. Sound2 = Instance.new("Sound")
  22. Decal3 = Instance.new("Decal")
  23. Decal4 = Instance.new("Decal")
  24. Decal5 = Instance.new("Decal")
  25. Decal6 = Instance.new("Decal")
  26. Decal7 = Instance.new("Decal")
  27. Decal8 = Instance.new("Decal")
  28. Script9 = Instance.new("Script")
  29. Script10 = Instance.new("Script")
  30. NumberValue11 = Instance.new("NumberValue")
  31. NumberValue12 = Instance.new("NumberValue")
  32. LocalScript13 = Instance.new("LocalScript")
  33. LocalScript14 = Instance.new("LocalScript")
  34. LocalScript15 = Instance.new("LocalScript")
  35. LocalScript16 = Instance.new("LocalScript")
  36. Tool0.Name = "C4"
  37. Tool0.Parent = mas
  38. Tool0.GripForward = Vector3.new(-0.999949992, 0.00999949966, -0)
  39. Tool0.GripRight = Vector3.new(0, 0, -1)
  40. Tool0.GripUp = Vector3.new(0.00999949966, 0.999949992, 0)
  41. Part1.Name = "Handle"
  42. Part1.Parent = Tool0
  43. Part1.BrickColor = BrickColor.new("Bright yellow")
  44. Part1.Rotation = Vector3.new(0, 0, -180)
  45. Part1.FormFactor = Enum.FormFactor.Symmetric
  46. Part1.Size = Vector3.new(2, 1, 2)
  47. Part1.CFrame = CFrame.new(-8.00000286, 0.5, 32, -1, 8.81815954e-09, 2.77323443e-06, -8.81815598e-09, -1, 9.62744329e-10, 2.77323443e-06, 9.62719904e-10, 1)
  48. Part1.BottomSurface = Enum.SurfaceType.Smooth
  49. Part1.TopSurface = Enum.SurfaceType.Smooth
  50. Part1.Color = Color3.new(0.960784, 0.803922, 0.188235)
  51. Part1.Position = Vector3.new(-8.00000286, 0.5, 32)
  52. Part1.Orientation = Vector3.new(0, 0, -180)
  53. Part1.Color = Color3.new(0.960784, 0.803922, 0.188235)
  54. Sound2.Name = "SlingshotSound"
  55. Sound2.Parent = Part1
  56. Sound2.SoundId = "rbxasset://sounds//Rubber band sling shot.wav"
  57. Sound2.Volume = 1
  58. Decal3.Parent = Part1
  59. Decal3.Texture = "http://www.roblox.com/asset/?id=6005835"
  60. Decal3.Face = Enum.NormalId.Bottom
  61. Decal4.Parent = Part1
  62. Decal4.Texture = "http://www.roblox.com/asset/?id=6005846"
  63. Decal4.Face = Enum.NormalId.Right
  64. Decal5.Parent = Part1
  65. Decal5.Texture = "http://www.roblox.com/asset/?id=6005846"
  66. Decal5.Face = Enum.NormalId.Back
  67. Decal6.Parent = Part1
  68. Decal6.Texture = "http://www.roblox.com/asset/?id=6005846"
  69. Decal6.Face = Enum.NormalId.Left
  70. Decal7.Parent = Part1
  71. Decal7.Texture = "http://www.roblox.com/asset/?id=6005846"
  72. Decal8.Parent = Part1
  73. Decal8.Texture = "http://www.roblox.com/asset/?id=6005835"
  74. Decal8.Face = Enum.NormalId.Top
  75. Script9.Name = "Slingshot"
  76. Script9.Parent = Tool0
  77. table.insert(cors,sandbox(Script9,function()
  78. Tool = script.Parent
  79. VELOCITY = 25 -- constant
  80.  
  81. local Pellet = script.Parent.Handle:clone()
  82. Pellet.Locked = true
  83. Pellet.BackSurface = 0
  84. Pellet.BottomSurface = 0
  85. Pellet.FrontSurface = 0
  86. Pellet.LeftSurface = 0
  87. Pellet.RightSurface = 0
  88. Pellet.TopSurface = 0
  89. Pellet.SlingshotSound:remove()
  90. script.Parent.Bomb:clone().Parent = Pellet
  91.  
  92. function fire(mouse_pos)
  93.  
  94.  
  95. Tool.Handle.SlingshotSound:play()
  96.  
  97. -- find player's head pos
  98.  
  99. local vCharacter = Tool.Parent
  100. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  101.  
  102. local head = vCharacter:findFirstChild("Head")
  103. if head == nil then return end
  104.  
  105. local dir = mouse_pos - head.Position
  106. dir = computeDirection(dir)
  107.  
  108. local launch = head.Position + 5 * dir
  109.  
  110. local delta = mouse_pos - launch
  111.  
  112. local dy = delta.y
  113.  
  114. local new_delta = Vector3.new(delta.x, 0, delta.z)
  115. delta = new_delta
  116.  
  117. local dx = delta.magnitude
  118. local unit_delta = delta.unit
  119.  
  120. -- acceleration due to gravity in RBX units
  121. local g = (-9.81 * 20)
  122.  
  123. local theta = computeLaunchAngle( dx, dy, g)
  124.  
  125. local vy = math.sin(theta)
  126. local xz = math.cos(theta)
  127. local vx = unit_delta.x * xz
  128. local vz = unit_delta.z * xz
  129.  
  130.  
  131. local missile = Pellet:clone()
  132.  
  133.  
  134.  
  135.  
  136. missile.Position = launch
  137. missile.Velocity = Vector3.new(vx,vy,vz) * VELOCITY
  138.  
  139. missile.Bomb.Disabled = false
  140.  
  141. local creator_tag = Instance.new("ObjectValue")
  142. creator_tag.Value = vPlayer
  143. creator_tag.Name = "creator"
  144. creator_tag.Parent = missile
  145.  
  146. missile.Parent = game.Workspace
  147. script.Parent.BombOut.Value = 1
  148.  
  149. end
  150.  
  151.  
  152. function computeLaunchAngle(dx,dy,grav)
  153. -- arcane
  154. -- http://en.wikipedia.org/wiki/Trajectory_of_a_projectile
  155.  
  156. local g = math.abs(grav)
  157. local inRoot = (VELOCITY*VELOCITY*VELOCITY*VELOCITY) - (g * ((g*dx*dx) + (2*dy*VELOCITY*VELOCITY)))
  158. if inRoot <= 0 then
  159. return .25 * math.pi
  160. end
  161. local root = math.sqrt(inRoot)
  162. local inATan1 = ((VELOCITY*VELOCITY) + root) / (g*dx)
  163.  
  164. local inATan2 = ((VELOCITY*VELOCITY) - root) / (g*dx)
  165. local answer1 = math.atan(inATan1)
  166. local answer2 = math.atan(inATan2)
  167. if answer1 < answer2 then return answer1 end
  168. return answer2
  169. end
  170.  
  171. function computeDirection(vec)
  172. local lenSquared = vec.magnitude * vec.magnitude
  173. local invSqrt = 1 / math.sqrt(lenSquared)
  174. return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
  175. end
  176.  
  177.  
  178.  
  179.  
  180. Tool.Enabled = true
  181. function onActivated()
  182.  
  183. if not Tool.Enabled or script.Parent.BombOut.Value == 1 then
  184. return
  185. end
  186. Pellet.Name = ""..script.Parent.Parent.Name.." Bomb"
  187. Tool.Enabled = false
  188.  
  189. local character = Tool.Parent;
  190. local humanoid = character.Humanoid
  191. if humanoid == nil then
  192. print("Humanoid not found")
  193. return
  194. end
  195.  
  196. local targetPos = humanoid.TargetPoint
  197.  
  198. fire(targetPos)
  199.  
  200. wait(.2)
  201.  
  202. Tool.Enabled = true
  203. end
  204.  
  205. script.Parent.Activated:connect(onActivated)
  206.  
  207.  
  208.  
  209. end))
  210. Script10.Name = "Bomb"
  211. Script10.Parent = Tool0
  212. Script10.Disabled = true
  213. table.insert(cors,sandbox(Script10,function()
  214. updateInterval = 0.4
  215.  
  216. currentColor = 1
  217. colors = {26, 21}
  218.  
  219. function onTouched(hit)
  220. local weld = Instance.new("Weld")
  221. weld.Part0 = script.Parent
  222. weld.Part1 = hit
  223. local temp = CFrame.new((script.Parent.Position + hit.Position) * 0.5)
  224. weld.C0 = script.Parent.CFrame:inverse() * temp
  225. weld.C1 = hit.CFrame:inverse() * temp
  226. weld.Parent = script.Parent
  227. connection:disconnect()
  228. Remove()
  229. end
  230.  
  231. function Remove()
  232. wait(10)
  233. if script.Parent.Parent ~= nil then
  234. script.Parent.Parent = nil
  235. elseif script.Parent.Parent == nil then
  236. return
  237. end
  238. end
  239.  
  240. connection = script.Parent.Touched:connect(onTouched)
  241.  
  242.  
  243.  
  244. end))
  245. NumberValue11.Name = "BombOut"
  246. NumberValue11.Parent = Tool0
  247. NumberValue12.Name = "Tutorialized"
  248. NumberValue12.Parent = Tool0
  249. NumberValue12.Value = 14
  250. LocalScript13.Parent = Tool0
  251. table.insert(cors,sandbox(LocalScript13,function()
  252. local Tool = script.Parent;
  253. local check = script.Parent.BombOut
  254. local db = script.Parent.Tutorialized
  255.  
  256. function onKeyDown(key)
  257. if (key~=nil) then
  258. key = key:lower()
  259. if (key=="q") then
  260. if script.Parent.BombOut.Value == 1 then
  261. local bomb = game.Workspace:FindFirstChild(""..script.Parent.Parent.Name.." Bomb")
  262. if bomb ~= nil then
  263. blowUp(bomb)
  264. bomb.Transparency = 1
  265. local decal = bomb:GetChildren()
  266. for i=1, #decal do
  267. if decal[i].className == "Decal" then
  268. decal[i]:remove()
  269. end
  270. end
  271. end
  272. wait(3)
  273. script.Parent.BombOut.Value = 0
  274. bomb:remove()
  275. end
  276. end
  277. end
  278. if (key=="e") then
  279. local clean = game.Workspace:GetChildren()
  280. for i=1, #clean do
  281. if clean[i].Name == ""..script.Parent.Parent.Name.." Bomb" then
  282. clean[i]:remove()
  283. end
  284. end
  285. script.Parent.BombOut.Value = 0
  286. end
  287. end
  288.  
  289. enabled = true
  290. function onButton1Down(mouse)
  291. if not enabled then
  292. return
  293. end
  294.  
  295. enabled = false
  296.  
  297.  
  298. wait(3)
  299.  
  300. enabled = true
  301.  
  302. end
  303.  
  304. function onEquippedLocal(mouse)
  305.  
  306. if mouse == nil then
  307. print("Mouse not found")
  308. return
  309. end
  310.  
  311.  
  312. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  313. mouse.KeyDown:connect(onKeyDown)
  314.  
  315. if db.Value == 0 then
  316. db.Value = 14
  317. local message = Instance.new("Hint")
  318. message.Parent = game.Players:findFirstChild(script.Parent.Parent.Name)
  319. message.Text = "Thanks for using C4 by Malvaviscos"
  320. wait(3)
  321. message.Text = "Click to drop C4 (Fires like a slingshot)"
  322. wait(3)
  323. message.Text = "Press 'q' to detonate the C4, and 'e' to remove it."
  324. wait(3)
  325. message.Text = "If the tool stops working, press 'e' also to reset it."
  326. wait(3)
  327. message:remove()
  328. end
  329. end
  330.  
  331. function blowUp(obj)
  332. local sound = Instance.new("Sound")
  333. sound.SoundId = "rbxasset://sounds\\Rocket shot.wav"
  334. sound.Parent = obj
  335. sound.Volume = 1
  336. sound:play()
  337. explosion = Instance.new("Explosion")
  338. explosion.BlastRadius = 15
  339. explosion.BlastPressure = 100 -- these are really wussy units
  340.  
  341. -- find instigator tag
  342. local creator = script.Parent:findFirstChild("creator")
  343. if creator ~= nil then
  344. explosion.Hit:connect(function(part, distance) onPlayerBlownUp(part, distance, creator) end)
  345. end
  346.  
  347. explosion.Position = obj.Position
  348. explosion.Parent = game.Workspace
  349. end
  350.  
  351. function onPlayerBlownUp(part, distance, creator)
  352. if part.Name == "Head" then
  353. local humanoid = part.Parent.Humanoid
  354. tagHumanoid(humanoid, creator)
  355. end
  356. end
  357.  
  358. function tagHumanoid(humanoid, creator)
  359. -- tag does not need to expire iff all explosions lethal
  360.  
  361. if creator ~= nil then
  362. local new_tag = creator:clone()
  363. new_tag.Parent = humanoid
  364. end
  365. end
  366.  
  367. function untagHumanoid(humanoid)
  368. if humanoid ~= nil then
  369. local tag = humanoid:findFirstChild("creator")
  370. if tag ~= nil then
  371. tag.Parent = nil
  372. end
  373. end
  374. end
  375.  
  376. Tool.Equipped:connect(onEquippedLocal)
  377.  
  378. end))
  379. LocalScript14.Name = "Local Gui"
  380. LocalScript14.Parent = Tool0
  381. table.insert(cors,sandbox(LocalScript14,function()
  382. local Tool = script.Parent;
  383.  
  384.  
  385.  
  386. enabled = true
  387.  
  388. function onButton1Down(mouse)
  389.  
  390. if not enabled then
  391.  
  392. return
  393.  
  394. end
  395.  
  396.  
  397.  
  398. enabled = false
  399.  
  400.  
  401.  
  402.  
  403.  
  404. wait(2)
  405.  
  406.  
  407.  
  408.  
  409. enabled = true
  410.  
  411.  
  412.  
  413. end
  414.  
  415.  
  416.  
  417. function onEquippedLocal(mouse)
  418.  
  419.  
  420.  
  421. if mouse == nil then
  422.  
  423. print("Mouse not found")
  424.  
  425. return
  426.  
  427. end
  428.  
  429.  
  430.  
  431.  
  432.  
  433. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  434.  
  435. end
  436.  
  437.  
  438.  
  439.  
  440.  
  441. Tool.Equipped:connect(onEquippedLocal)
  442.  
  443.  
  444. end))
  445. LocalScript15.Name = "IFF"
  446. LocalScript15.Parent = Tool0
  447. table.insert(cors,sandbox(LocalScript15,function()
  448. --hey. it's me alextomcool. just change the normel, friendly and enemy crosshair's or just use the starter crosshair's.
  449. --this was modifed from a KeyDoor script. credit's to whomever made the KeyDoors
  450.  
  451. bin = script.Parent
  452. normel = "http://www.roblox.com/asset/?id=7419350"
  453. friendly = "http://www.roblox.com/asset/?id=7419364"
  454. enemy = "http://www.roblox.com/asset/?id=7419379"
  455. function Run(mouse)
  456. mouse.Icon = normel
  457. local hit = mouse.Target
  458. if (hit == nil) then return end
  459. h = hit.Parent:FindFirstChild("Humanoid")
  460. if h ~= nil then
  461. torso = hit.Parent.Torso
  462. if torso ~= nil then
  463. if h.Health > 0 then
  464. if (torso.BrickColor == bin.Parent.Torso.BrickColor) then
  465. mouse.Icon = friendly
  466. elseif torso.BrickColor ~= bin.Parent.Torso.BrickColor then
  467. mouse.Icon = enemy
  468. end
  469. end
  470. end
  471.  
  472. end
  473. end
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481. function on(mouse)
  482. while true do
  483. wait()
  484. Run(mouse)
  485. end
  486. end
  487.  
  488.  
  489.  
  490. script.Parent.Equipped:connect(on)
  491.  
  492.  
  493. end))
  494. LocalScript16.Name = "AmmoScript"
  495. LocalScript16.Parent = Tool0
  496. table.insert(cors,sandbox(LocalScript16,function()
  497. Tool = script.Parent
  498. function equip()
  499. print("Equipped")
  500. if game.Players.LocalPlayer ~= nil then
  501. local m = Instance.new("Message")
  502. m.Parent = game.Players.LocalPlayer
  503. m.Name = "AmmoStats"
  504. while m ~= nil do
  505. wait(0.1)
  506. m.Text = "click to place charge"
  507. wait(2)
  508. m.Text = "E to remove charge"
  509. wait(2)
  510. m.Text = "Q to detonate charge"
  511. wait(2)
  512. m.Text = "Or Press E to reset the tool"
  513. wait(2)
  514. m:remove()
  515. end
  516. end
  517. end
  518.  
  519. function unequip()
  520. print("Unequipped")
  521. if game.Players.LocalPlayer ~= nil then
  522. print("localplayer found")
  523. local m = game.Players.LocalPlayer:FindFirstChild("AmmoStats")
  524. if m ~= nil then
  525. m:remove()
  526. end
  527. end
  528. end
  529.  
  530. script.Parent.Equipped:connect(equip)
  531. script.Parent.Unequipped:connect(unequip)
  532.  
  533. end))
  534. for i,v in pairs(mas:GetChildren()) do
  535. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  536. pcall(function() v:MakeJoints() end)
  537. end
  538. mas:Destroy()
  539. for i,v in pairs(cors) do
  540. spawn(function()
  541. pcall(v)
  542. end)
  543. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement