Advertisement
Animescapetower

GUN3

Mar 16th, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.71 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. SpecialMesh2 = Instance.new("SpecialMesh")
  22. Sound3 = Instance.new("Sound")
  23. Sound4 = Instance.new("Sound")
  24. LocalScript5 = Instance.new("LocalScript")
  25. Script6 = Instance.new("Script")
  26. Script7 = Instance.new("Script")
  27. NumberValue8 = Instance.new("NumberValue")
  28. Part9 = Instance.new("Part")
  29. SpotLight10 = Instance.new("SpotLight")
  30. Part11 = Instance.new("Part")
  31. SpecialMesh12 = Instance.new("SpecialMesh")
  32. Script13 = Instance.new("Script")
  33. Script14 = Instance.new("Script")
  34. Script15 = Instance.new("Script")
  35. Script16 = Instance.new("Script")
  36. Script17 = Instance.new("Script")
  37. LocalScript18 = Instance.new("LocalScript")
  38. LocalScript19 = Instance.new("LocalScript")
  39. LocalScript20 = Instance.new("LocalScript")
  40. LocalScript21 = Instance.new("LocalScript")
  41. LocalScript22 = Instance.new("LocalScript")
  42. LocalScript23 = Instance.new("LocalScript")
  43. Script24 = Instance.new("Script")
  44. Weld25 = Instance.new("Weld")
  45. Tool0.Name = "DarkMatterGun"
  46. Tool0.Parent = mas
  47. Tool0.GripPos = Vector3.new(0, 0, 0.699999988)
  48. Part1.Name = "Handle"
  49. Part1.Parent = Tool0
  50. Part1.BrickColor = BrickColor.new("Really black")
  51. Part1.Transparency = 1
  52. Part1.Rotation = Vector3.new(164.429993, 0, -180)
  53. Part1.FormFactor = Enum.FormFactor.Custom
  54. Part1.Size = Vector3.new(0.800000012, 1.29999995, 2.20000005)
  55. Part1.CFrame = CFrame.new(114.459999, 1.10675097, 10.1949997, -1, 0, 0, 0, 0.963300645, -0.268424839, 0, -0.268424839, -0.963300645)
  56. Part1.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  57. Part1.Position = Vector3.new(114.459999, 1.10675097, 10.1949997)
  58. Part1.Orientation = Vector3.new(15.5699997, 180, 0)
  59. Part1.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  60. SpecialMesh2.Parent = Part1
  61. SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=85771489"
  62. SpecialMesh2.Scale = Vector3.new(0.75, 0.75, 0.75)
  63. SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=85884363"
  64. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  65. SpecialMesh2.Scale = Vector3.new(0.75, 0.75, 0.75)
  66. Sound3.Parent = Part1
  67. Sound3.SoundId = "http://www.roblox.com/asset/?id=77170656"
  68. Sound3.Volume = 1
  69. Sound4.Name = "Reload"
  70. Sound4.Parent = Part1
  71. Sound4.SoundId = "http://www.roblox.com/asset/?id=131164874"
  72. Sound4.Volume = 1
  73. LocalScript5.Parent = Tool0
  74. table.insert(cors,sandbox(LocalScript5,function()
  75. --har he ho
  76.  
  77. local Tool = script.Parent
  78. sp=script.Parent
  79. plr=game.Players.localPlayer
  80.  
  81.  
  82. damage=30
  83. local reloadTime = .25
  84. local orb
  85. local Mouse
  86. firerate=1
  87. local range = 250
  88. barreloffset=Vector3.new(0, 0.25, -1.7)
  89. windvec=Vector3.new(2,-1,1).unit
  90.  
  91. rate=1/30
  92. debris=game:GetService("Debris")
  93. equipped=false
  94. check=true
  95.  
  96. local PewPew = Tool.Handle:FindFirstChild("PewPew")
  97.  
  98. if (PewPew == nil) then
  99. PewPew = Instance.new("Sound")
  100. PewPew.Name = "PewPew"
  101. PewPew.SoundId = "http://www.roblox.com/asset/?id=131179973"
  102. PewPew.Parent = Tool.Handle
  103. PewPew.Pitch = 1 --.85
  104. PewPew.Volume = .85
  105. end
  106.  
  107. local laserSound = Tool.Handle:FindFirstChild("LaserSound")
  108.  
  109. if (laserSound == nil) then
  110. laserSound = Instance.new("Sound")
  111. laserSound.Name = "LaserSound"
  112. laserSound.SoundId = "http://www.roblox.com/asset/?id=131164846"
  113. laserSound.Parent = Tool.Handle
  114. laserSound.Pitch = 0.96 --.85
  115. laserSound.Volume = 3
  116. end
  117.  
  118.  
  119.  
  120. function tagHumanoid(humanoid)
  121. local creator_tag=Instance.new("ObjectValue")
  122. creator_tag.Value=game.Players.LocalPlayer
  123. creator_tag.Name="creator"
  124. debris:AddItem(creator,.5)
  125. creator_tag.Parent=humanoid
  126. end
  127.  
  128. function damagePartOwner(part, damage)
  129. if part and part.Parent and Tool and Tool.Parent and plr and Tool.Parent ~= part.Parent then
  130. local hum = part.Parent:FindFirstChild("Humanoid")
  131. if hum then
  132. tagHumanoid(hum)
  133. hum.Health = hum.Health - damage
  134. --hum:TakeDamage(damage)
  135. return true
  136. end
  137. end
  138. return false
  139. end
  140.  
  141. function checkintangible(hit)
  142. if hit and hit~=nil then
  143. if hit:IsDescendantOf(Tool.Parent) or hit.Transparency>.9 or hit.Name=="Handle" or hit.Name=="Effect" or hit.Name=="Bullet" or hit.Name=="Laser" or string.lower(hit.Name)=="water" then
  144. return true
  145. end
  146. end
  147. return false
  148. end
  149.  
  150. function castray(startpos,vec,length,ignore,delayifhit)
  151. local hit,endpos2=game.Workspace:FindPartOnRay(Ray.new(startpos,vec*length),ignore)
  152. if hit~=nil then
  153. if checkintangible(hit) then
  154. if delayifhit then
  155. wait()
  156. end
  157. hit,endpos2=castray(endpos2+(vec*.01),vec,length-((startpos-endpos2).magnitude),ignore,delayifhit)
  158. end
  159. end
  160. return hit,endpos2
  161. end
  162.  
  163. function drawbeam(beamstart,beamend,clr,charge)
  164. local dist=(beamstart-beamend).magnitude
  165. local laser=Instance.new("Part")
  166. laser.Name="Effect"
  167. --laser.Anchored=true
  168. laser.CanCollide=false
  169. laser.Shape="Block"
  170. laser.formFactor="Custom"
  171. laser.Size=Vector3.new(.2,.2,.2)
  172. laser.Transparency=0
  173. laser.Material=Enum.Material.Plastic
  174. laser.Locked=true
  175. laser.TopSurface=0
  176. laser.BottomSurface=0
  177. laser.BrickColor=clr
  178. laser.CFrame=CFrame.new(beamend,beamstart)*CFrame.new(0,0,-dist/2)*CFrame.Angles(math.pi/2,0,0)
  179. local mesh=Instance.new("SpecialMesh")
  180. local scale = math.sqrt(charge/20)
  181. mesh.Scale=Vector3.new(scale,dist*5,scale)
  182. mesh.Parent=laser
  183. return laser
  184.  
  185. end
  186.  
  187. local charge = -100
  188.  
  189. function fireSmallLaser(charge)
  190. if orb then
  191. PewPew:Play()
  192. --print("firing laser")
  193. local startpos = orb.Position
  194. local vec = (Mouse.Hit.p-startpos).unit
  195. local smallLaser = drawbeam(startpos, startpos + vec * 3, BrickColor.new(Color3.new(0,0,0)), charge )
  196. local bv = Instance.new("BodyVelocity")
  197. bv.velocity = vec *200
  198. bv.Parent = smallLaser
  199. debris:AddItem(smallLaser,5)
  200. smallLaser.Parent = game.Workspace
  201. local damage = 5+math.floor(charge/2)
  202. smallLaser.Touched:connect(function(hit)
  203. local didDamage = damagePartOwner(hit,damage)
  204. --print("hit, ", didDamage)
  205. if didDamage and smallLaser then smallLaser:Destroy() end
  206. end)
  207. orb:Destroy()
  208. end
  209. end
  210.  
  211. function fireLargeLaser()
  212. local frames = 57
  213. local largeLaser
  214.  
  215. laserSound:Play()
  216. for i = 1, frames do
  217. if not orb or not orb.Parent or not Mouse then break end
  218. local startpos = orb.Position
  219. local hit, endPos = castray(startpos, (Mouse.Hit.p-startpos).unit, range, Tool.Parent)
  220. damagePartOwner(hit,5)
  221. if largeLaser then largeLaser:Destroy() end
  222. largeLaser = drawbeam(startpos, endPos, BrickColor.new(Color3.new(0,0,0)), 300)
  223. largeLaser.Anchored = true
  224.  
  225.  
  226. debris:AddItem(largeLaser,.25)
  227. largeLaser.Parent = game.Workspace
  228.  
  229.  
  230. wait(1/30)
  231. end
  232. if largeLaser then largeLaser:Destroy() end
  233. if orb then orb:Destroy() end
  234. Tool.Handle.Reload:Play()
  235. wait(4)
  236. end
  237.  
  238. local isFiring = false
  239. function mouseUp()
  240. --print("mouseUpped")
  241. --if Tool.Enabled then return end
  242. if not orb or not orb.Parent or isFiring then return end
  243. isFiring = true
  244.  
  245. if Mouse then Mouse.Icon = "rbxasset://textures\\GunWaitCursor.png" end
  246. --TODO: reset characters walkspeed
  247. if charge > 100 then
  248. charge = -100
  249. fireLargeLaser()
  250. else
  251. fireSmallLaser(charge)
  252. charge = -100
  253. end
  254. wait(reloadTime)
  255. isFiring = false
  256. Tool.Enabled = true
  257. if Mouse then Mouse.Icon = "rbxasset://textures\\GunCursor.png" end
  258. end
  259.  
  260.  
  261. function mouseDown()
  262. --print("mouseDowned")
  263. if not Tool.Enabled then return end
  264. Tool.Enabled = false
  265. if orb and orb.Parent then return end
  266. --TODO: nuke characters walkspeed
  267. charge = 5
  268.  
  269. orb = Instance.new("Part")
  270. orb.FormFactor = "Symmetric"
  271. orb.Shape = "Ball"
  272. orb.CanCollide = false
  273. orb.Size = Vector3.new(1,1,1)
  274. orb.Transparency = .4
  275. orb.BrickColor = BrickColor.new(Color3.new(0,0,0))
  276. orb.TopSurface = "Smooth"
  277. orb.BottomSurface = "Smooth"
  278.  
  279. local ballMesh = Instance.new("SpecialMesh")
  280. ballMesh.MeshType = "Sphere"
  281. ballMesh.Name = "SphereMesh"
  282. ballMesh.Parent = orb
  283. local scale = math.sqrt(charge/20)
  284. ballMesh.Scale = Vector3.new(scale,scale,scale)
  285.  
  286. orb.Parent = Tool
  287.  
  288. suckPartModel = orb:Clone()
  289. suckPartModel.Size = suckPartModel.Size * .5
  290. --suckPartModel.SphereMesh.Scale = suckPartModel.SphereMesh.Scale * .5
  291. local bv = Instance.new("BodyVelocity")
  292. bv.Name = "BV"
  293. bv.Parent = suckPartModel
  294.  
  295. local orbWeld = Instance.new("ManualWeld")
  296. orbWeld.C0 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  297. orbWeld.C1 = CFrame.new(0.049407959, 0.30989188, -1.74499893, 0.999999881, -0.000551184872, -5.29387343e-008, 0.000551184872, 0.999999762, 1.45519152e-011, 4.31729106e-008, -1.45519152e-011, 1)
  298. orbWeld.Part0 = orb
  299. orbWeld.Part1 = Tool.Handle
  300. orbWeld.Parent = orb
  301. --TODO: make sure gun handle is correct first
  302. --TODO: weld orb to end of gun
  303.  
  304. if Mouse then Mouse.TargetFilter = orb end --stops player from shooting at the special effects
  305.  
  306. while orb and ballMesh and charge > 0 do
  307. local suckPart = suckPartModel:Clone()
  308. suckPart.CFrame = orb.CFrame + Vector3.new((math.random()-.5)*4,(math.random()-.5)*4,(math.random()-.5)*4)
  309. suckPart.BV.velocity = (orb.CFrame.p - suckPart.CFrame.p).unit *7
  310. debris:AddItem(suckPart,(orb.CFrame.p - suckPart.CFrame.p).magnitude/12)
  311. suckPart.Parent = orb
  312.  
  313. --TODO: suck in particles
  314. if charge < 100 then
  315. scale = math.sqrt(charge/20)
  316. ballMesh.Scale = Vector3.new(scale,scale,scale)
  317. else
  318. local colorVal = math.max(charge %11, 11 - charge%11) --Varies smoothly from 6 to 11 and back
  319. local scaledColorVal = (colorVal-5)/20
  320. orb.BrickColor = BrickColor.new(Color3.new(1,scaledColorVal,scaledColorVal))
  321. --TODO make orb large and change color
  322. end
  323. charge = charge +1
  324. --print(charge)
  325. wait(1/30)
  326. end
  327.  
  328. end
  329.  
  330.  
  331. function onEquipped(mouse)
  332. equipped=true
  333.  
  334. if mouse~=nil then
  335. if not Tool.Enabled then
  336. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  337. wait(2)
  338. Tool.Enabled = true
  339. end
  340. Mouse = mouse
  341. Mouse.Icon="rbxasset://textures\\GunCursor.png"
  342. Mouse.Button1Down:connect(mouseDown)
  343. Mouse.Button1Up:connect(mouseUp)
  344. end
  345. end
  346.  
  347. function onUnequipped()
  348. if orb then orb:Destroy() end
  349. equipped=false
  350. end
  351.  
  352. function movehead()
  353. --[[
  354. [Head/Waist Follow Mouse/Camera Script.]
  355. [Works with both R6 and R15, lets you turn your character's head and waist towards your mouse/camera.]
  356. [Scripted by (Unknown), upgraded by OhHeyItsCory.]
  357. [I'm not sure who made the original script and the person I found it from definitely didn't make it.]
  358. [If you find the original creator, please let me know so I can properly credit them <3]
  359. [Anyways, here's a list of what I've added.]
  360. [Waist rotation. (Previously, only the head turned.)]
  361. [Tweening. (Basically, animating the rotation instead of instantly turning.)]
  362. [Full body rotation. (If set to true, rotates the entire body towards the mouse.)]
  363. [Specific rotation limits. (The original script used one variable to set the limits of both horizontal and vertical rotation, now there's variables for both limits!)]
  364. --]]
  365.  
  366. wait()
  367.  
  368. --[Pre-Funcs]:
  369.  
  370. local Ang = CFrame.Angles --[Storing these as variables so I dont have to type them out.]
  371. local aSin = math.asin
  372. local aTan = math.atan
  373.  
  374. --[Constants]:
  375.  
  376. local Cam = game.Workspace.CurrentCamera
  377.  
  378. local Plr = game.Players.LocalPlayer
  379. local Mouse = Plr:GetMouse()
  380. local Body = Plr.Character or Plr.CharacterAdded:wait()
  381. local Head = Body:WaitForChild("Head")
  382. local Hum = Body:WaitForChild("Humanoid")
  383. local Core = Body:WaitForChild("HumanoidRootPart")
  384. local IsR6 = (Hum.RigType.Value==0) --[Checking if the player is using R15 or R6.]
  385. local Trso = (IsR6 and Body:WaitForChild("Torso")) or Body:WaitForChild("UpperTorso")
  386. local Neck = (IsR6 and Trso:WaitForChild("Neck")) or Head:WaitForChild("Neck") --[Once we know the Rig, we know what to find.]
  387. local Waist = (not IsR6 and Trso:WaitForChild("Waist")) --[R6 doesn't have a waist joint, unfortunately.]
  388.  
  389. --[[
  390. [Whether rotation follows the camera or the mouse.]
  391. [Useful with tools if true, but camera tracking runs smoother.]
  392. --]]
  393. local MseGuide = false
  394. --[[
  395. [Whether the whole character turns to face the mouse.]
  396. [If set to true, MseGuide will be set to true and both HeadHorFactor and BodyHorFactor will be set to 0]
  397. --]]
  398. local TurnCharacterToMouse = false
  399. --[[
  400. [Horizontal and Vertical limits for head and body tracking.]
  401. [Setting to 0 negates tracking, setting to 1 is normal tracking, and setting to anything higher than 1 goes past real life head/body rotation capabilities.]
  402. --]]
  403. local HeadHorFactor = 1
  404. local HeadVertFactor = 0.6
  405. local BodyHorFactor = 0.5
  406. local BodyVertFactor = 0.4
  407.  
  408. --[[
  409. [How fast the body rotates.]
  410. [Setting to 0 negates tracking, and setting to 1 is instant rotation. 0.5 is a nice in-between that works with MseGuide on or off.]
  411. [Setting this any higher than 1 causes weird glitchy shaking occasionally.]
  412. --]]
  413. local UpdateSpeed = 0.5
  414.  
  415. local NeckOrgnC0 = Neck.C0 --[Get the base C0 to manipulate off of.]
  416. local WaistOrgnC0 = (not IsR6 and Waist.C0) --[Get the base C0 to manipulate off of.]
  417.  
  418. --[Setup]:
  419.  
  420. Neck.MaxVelocity = 1/3
  421.  
  422. -- Activation]:
  423. if TurnCharacterToMouse == true then
  424. MseGuide = true
  425. HeadHorFactor = 0
  426. BodyHorFactor = 0
  427. end
  428.  
  429. game:GetService("RunService").RenderStepped:Connect(function()
  430. local CamCF = Cam.CoordinateFrame
  431. if ((IsR6 and Body["Torso"]) or Body["UpperTorso"])~=nil and Body["Head"]~=nil then --[Check for the Torso and Head...]
  432. local TrsoLV = Trso.CFrame.lookVector
  433. local HdPos = Head.CFrame.p
  434. if IsR6 and Neck or Neck and Waist then --[Make sure the Neck still exists.]
  435. if Cam.CameraSubject:IsDescendantOf(Body) or Cam.CameraSubject:IsDescendantOf(Plr) then
  436. local Dist = nil;
  437. local Diff = nil;
  438. if not MseGuide then --[If not tracking the Mouse then get the Camera.]
  439. Dist = (Head.CFrame.p-CamCF.p).magnitude
  440. Diff = Head.CFrame.Y-CamCF.Y
  441. if not IsR6 then --[R6 and R15 Neck rotation C0s are different; R15: X axis inverted and Z is now the Y.]
  442. Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang((aSin(Diff/Dist)*HeadVertFactor), -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y*HeadHorFactor, 0), UpdateSpeed/2)
  443. Waist.C0 = Waist.C0:lerp(WaistOrgnC0*Ang((aSin(Diff/Dist)*BodyVertFactor), -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y*BodyHorFactor, 0), UpdateSpeed/2)
  444. else --[R15s actually have the properly oriented Neck CFrame.]
  445. Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang(-(aSin(Diff/Dist)*HeadVertFactor), 0, -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y*HeadHorFactor),UpdateSpeed/2)
  446. end
  447. else
  448. local Point = Mouse.Hit.p
  449. Dist = (Head.CFrame.p-Point).magnitude
  450. Diff = Head.CFrame.Y-Point.Y
  451. if not IsR6 then
  452. Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang(-(aTan(Diff/Dist)*HeadVertFactor), (((HdPos-Point).Unit):Cross(TrsoLV)).Y*HeadHorFactor, 0), UpdateSpeed/2)
  453. Waist.C0 = Waist.C0:lerp(WaistOrgnC0*Ang(-(aTan(Diff/Dist)*BodyVertFactor), (((HdPos-Point).Unit):Cross(TrsoLV)).Y*BodyHorFactor, 0), UpdateSpeed/2)
  454. else
  455. Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang((aTan(Diff/Dist)*HeadVertFactor), 0, (((HdPos-Point).Unit):Cross(TrsoLV)).Y*HeadHorFactor), UpdateSpeed/2)
  456. end
  457. end
  458. end
  459. end
  460. end
  461. if TurnCharacterToMouse == true then
  462. Hum.AutoRotate = false
  463. Core.CFrame = Core.CFrame:lerp(CFrame.new(Core.Position, Vector3.new(Mouse.Hit.p.x, Core.Position.Y, Mouse.Hit.p.z)), UpdateSpeed / 2)
  464. else
  465. Hum.AutoRotate = true
  466. end
  467. end)
  468.  
  469. end
  470. Tool.Equipped:connect(movehead)
  471. Tool.Equipped:connect(onEquipped)
  472. Tool.Unequipped:connect(onUnequipped)
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479. end))
  480. Script6.Name = "SoundScript"
  481. Script6.Parent = Tool0
  482. Script6.Disabled = true
  483. table.insert(cors,sandbox(Script6,function()
  484. --Stickamsterluke
  485. --this script this made so that the sound is not played locally
  486.  
  487.  
  488. sp=script.Parent
  489.  
  490. local s=Instance.new("Sound")
  491. s.Volume=2
  492. s.SoundId="http://www.roblox.com/asset/?id=77170993"
  493. s.Looped=false
  494. s.PlayOnRemove=false
  495. s.Parent=sp
  496. wait()
  497. s:Play()
  498.  
  499.  
  500.  
  501. end))
  502. Script7.Parent = Tool0
  503. table.insert(cors,sandbox(Script7,function()
  504. --Stickamsterluke
  505. --this script this made so that the sound is not played locally
  506.  
  507.  
  508. sp=script.Parent
  509.  
  510.  
  511. wait(1)
  512.  
  513. sp.PlaySound.Changed:connect(function()
  514. sp.Handle.Sound:Play()
  515. end)
  516.  
  517.  
  518.  
  519. end))
  520. NumberValue8.Name = "PlaySound"
  521. NumberValue8.Parent = Tool0
  522. NumberValue8.Value = 1336154690.422
  523. Part9.Name = "Light"
  524. Part9.Parent = Tool0
  525. Part9.Transparency = 1
  526. Part9.Rotation = Vector3.new(164.429993, 0, -180)
  527. Part9.CanCollide = false
  528. Part9.FormFactor = Enum.FormFactor.Custom
  529. Part9.Size = Vector3.new(0.200000003, 0.240000144, 0.860001147)
  530. Part9.CFrame = CFrame.new(114.470001, 1.03175199, 10.0339975, -1, 0, 0, 0, 0.963300645, -0.268424839, 0, -0.268424839, -0.963300645)
  531. Part9.Position = Vector3.new(114.470001, 1.03175199, 10.0339975)
  532. Part9.Orientation = Vector3.new(15.5699997, 180, 0)
  533. SpotLight10.Parent = Part9
  534. SpotLight10.Brightness = 10
  535. SpotLight10.Range = 28
  536. SpotLight10.Shadows = true
  537. SpotLight10.Angle = 100
  538. Part11.Name = "gun"
  539. Part11.Parent = Tool0
  540. Part11.Rotation = Vector3.new(164.429993, 0, -180)
  541. Part11.CanCollide = false
  542. Part11.FormFactor = Enum.FormFactor.Symmetric
  543. Part11.Size = Vector3.new(2, 2, 2)
  544. Part11.CFrame = CFrame.new(114.449997, 1.23175001, 10.1620016, -1, 0, 0, 0, 0.963300645, -0.268424839, 0, -0.268424839, -0.963300645)
  545. Part11.Position = Vector3.new(114.449997, 1.23175001, 10.1620016)
  546. Part11.Orientation = Vector3.new(15.5699997, 180, 0)
  547. SpecialMesh12.Parent = Part11
  548. SpecialMesh12.MeshId = "http://www.roblox.com/asset/?id=139121396"
  549. SpecialMesh12.Scale = Vector3.new(2, 3, 3)
  550. SpecialMesh12.TextureId = "http://www.roblox.com/asset/?id=139333401"
  551. SpecialMesh12.MeshType = Enum.MeshType.FileMesh
  552. SpecialMesh12.Scale = Vector3.new(2, 3, 3)
  553. Script13.Name = "UltimateWeld"
  554. Script13.Parent = Tool0
  555. table.insert(cors,sandbox(Script13,function()
  556. --DO NOT USE BOTH WELDING SCRIPTS PROVIDED BY THIS MODEL
  557. --The regular script is recommended
  558.  
  559.  
  560.  
  561. --[[
  562. Prevents welds from breaking/transforming when player uses the tool
  563. This recreates the EXACT weld every time
  564. This also prevents lag build up by clearing old welds, the tradition weld script just keeps making new
  565. ones, which can lead to weapons have crazy amounts of welds that dont work (I saw 6000 in a weapon once)
  566. ]]
  567.  
  568. --[[Usage
  569. 1. Remove Old welding script (optional, only if updating a weapon and that weapon does not rely on that script)
  570. 2. Anchor all parts of tool and put inside of a tool object
  571. 3. Place this script in that tool (make sure you do this AFTER step 2, otherwise it may fail)
  572. 4. Treat like normal tool, nothing special has to be done with it
  573. ]]
  574.  
  575. --[[The local script included in this model can only be used if
  576. 1. The weapon is being placed in the players backpack first (i.e. the weapon is in starterpack and moves to player backpack)
  577. OR
  578. 2. The weapon is previously welded (weapon can be placed in workspace and picked up then)
  579. ]]
  580. repeat wait() until script.Parent:FindFirstChild("Handle")
  581. local welds={}
  582. function ClearOldWelds(tbl)
  583. for _,v in pairs(tbl) do
  584. if v:IsA('Weld') then
  585. v:Destroy()
  586. end
  587. end
  588. end
  589.  
  590. function Equipped()
  591. local handle=script.Parent:FindFirstChild('Handle')
  592. if not handle then return end
  593. local tble=handle:GetChildren()
  594. for _,v in pairs(script.Parent:GetChildren()) do
  595. if v:IsA('BasePart') and v~=handle then
  596. local c1
  597. for _1,v1 in pairs(welds) do
  598. if _1==v then
  599. c1=v1
  600. break
  601. end
  602. end
  603. if not c1 then
  604. welds[v]=v.CFrame:inverse()*handle.CFrame
  605. v.Anchored=false
  606. c1=welds[v]
  607. end
  608. local weld=Instance.new('Weld')
  609. weld.Part0=handle
  610. weld.Part1=v
  611. weld.C0=CFrame.new()
  612. weld.C1=c1
  613. weld.Parent=handle
  614. end
  615. end
  616. ClearOldWelds(tble)
  617. handle.Anchored=false
  618. end
  619. Equipped()
  620. script.Parent.Equipped:connect(Equipped)
  621.  
  622. --Made by DonnyTheDemented
  623.  
  624. end))
  625. Script14.Name = "Welding"
  626. Script14.Parent = Tool0
  627. table.insert(cors,sandbox(Script14,function()
  628. function Weld(x,y)
  629. local W = Instance.new("Weld")
  630. W.Part0 = x
  631. W.Part1 = y
  632. local CJ = CFrame.new(x.Position)
  633. local C0 = x.CFrame:inverse()*CJ
  634. local C1 = y.CFrame:inverse()*CJ
  635. W.C0 = C0
  636. W.C1 = C1
  637. W.Parent = x
  638. end
  639.  
  640. function Get(A)
  641. if A.className == "Part" then
  642. Weld(script.Parent.Handle, A)
  643. A.Anchored = false
  644. else
  645. local C = A:GetChildren()
  646. for i=1, #C do
  647. Get(C[i])
  648. end
  649. end
  650. end
  651.  
  652. function Finale()
  653. Get(script.Parent)
  654. end
  655.  
  656. script.Parent.Equipped:connect(Finale)
  657. script.Parent.Unequipped:connect(Finale)
  658. Finale()
  659. end))
  660. Script15.Name = "Welding"
  661. Script15.Parent = Tool0
  662. table.insert(cors,sandbox(Script15,function()
  663. function Weld(x,y)
  664. local W = Instance.new("Weld")
  665. W.Part0 = x
  666. W.Part1 = y
  667. local CJ = CFrame.new(x.Position)
  668. local C0 = x.CFrame:inverse()*CJ
  669. local C1 = y.CFrame:inverse()*CJ
  670. W.C0 = C0
  671. W.C1 = C1
  672. W.Parent = x
  673. end
  674.  
  675. function Get(A)
  676. if A.className == "Part" then
  677. Weld(script.Parent.Handle, A)
  678. A.Anchored = false
  679. else
  680. local C = A:GetChildren()
  681. for i=1, #C do
  682. Get(C[i])
  683. end
  684. end
  685. end
  686.  
  687. function Finale()
  688. Get(script.Parent)
  689. end
  690.  
  691. script.Parent.Equipped:connect(Finale)
  692. script.Parent.Unequipped:connect(Finale)
  693. Finale()
  694. end))
  695. Script16.Name = "Welding"
  696. Script16.Parent = Tool0
  697. table.insert(cors,sandbox(Script16,function()
  698. function Weld(x,y)
  699. local W = Instance.new("Weld")
  700. W.Part0 = x
  701. W.Part1 = y
  702. local CJ = CFrame.new(x.Position)
  703. local C0 = x.CFrame:inverse()*CJ
  704. local C1 = y.CFrame:inverse()*CJ
  705. W.C0 = C0
  706. W.C1 = C1
  707. W.Parent = x
  708. end
  709.  
  710. function Get(A)
  711. if A.className == "Part" then
  712. Weld(script.Parent.Handle, A)
  713. A.Anchored = false
  714. else
  715. local C = A:GetChildren()
  716. for i=1, #C do
  717. Get(C[i])
  718. end
  719. end
  720. end
  721.  
  722. function Finale()
  723. Get(script.Parent)
  724. end
  725.  
  726. script.Parent.Equipped:connect(Finale)
  727. script.Parent.Unequipped:connect(Finale)
  728. Finale()
  729. end))
  730. Script17.Name = "Welding"
  731. Script17.Parent = Tool0
  732. table.insert(cors,sandbox(Script17,function()
  733. function Weld(x,y)
  734. local W = Instance.new("Weld")
  735. W.Part0 = x
  736. W.Part1 = y
  737. local CJ = CFrame.new(x.Position)
  738. local C0 = x.CFrame:inverse()*CJ
  739. local C1 = y.CFrame:inverse()*CJ
  740. W.C0 = C0
  741. W.C1 = C1
  742. W.Parent = x
  743. end
  744.  
  745. function Get(A)
  746. if A.className == "Part" then
  747. Weld(script.Parent.Handle, A)
  748. A.Anchored = false
  749. else
  750. local C = A:GetChildren()
  751. for i=1, #C do
  752. Get(C[i])
  753. end
  754. end
  755. end
  756.  
  757. function Finale()
  758. Get(script.Parent)
  759. end
  760.  
  761. script.Parent.Equipped:connect(Finale)
  762. script.Parent.Unequipped:connect(Finale)
  763. Finale()
  764. end))
  765. LocalScript18.Name = "BackupWeld"
  766. LocalScript18.Parent = Tool0
  767. table.insert(cors,sandbox(LocalScript18,function()
  768. function Weld(x,y)
  769. local W = Instance.new("Weld")
  770. W.Part0 = x
  771. W.Part1 = y
  772. local CJ = CFrame.new(x.Position)
  773. local C0 = x.CFrame:inverse()*CJ
  774. local C1 = y.CFrame:inverse()*CJ
  775. W.C0 = C0
  776. W.C1 = C1
  777. W.Parent = x
  778. end
  779.  
  780. function Get(A)
  781. if A.className == "Part" then
  782. Weld(script.Parent.Handle, A)
  783. A.Anchored = false
  784. else
  785. local C = A:GetChildren()
  786. for i=1, #C do
  787. Get(C[i])
  788. end
  789. end
  790. end
  791.  
  792. function Finale()
  793. Get(script.Parent)
  794. end
  795.  
  796. script.Parent.Equipped:connect(Finale)
  797. script.Parent.Unequipped:connect(Finale)
  798. Finale()
  799. end))
  800. LocalScript19.Name = "BackupWeld"
  801. LocalScript19.Parent = Tool0
  802. table.insert(cors,sandbox(LocalScript19,function()
  803. function Weld(x,y)
  804. local W = Instance.new("Weld")
  805. W.Part0 = x
  806. W.Part1 = y
  807. local CJ = CFrame.new(x.Position)
  808. local C0 = x.CFrame:inverse()*CJ
  809. local C1 = y.CFrame:inverse()*CJ
  810. W.C0 = C0
  811. W.C1 = C1
  812. W.Parent = x
  813. end
  814.  
  815. function Get(A)
  816. if A.className == "Part" then
  817. Weld(script.Parent.Handle, A)
  818. A.Anchored = false
  819. else
  820. local C = A:GetChildren()
  821. for i=1, #C do
  822. Get(C[i])
  823. end
  824. end
  825. end
  826.  
  827. function Finale()
  828. Get(script.Parent)
  829. end
  830.  
  831. script.Parent.Equipped:connect(Finale)
  832. script.Parent.Unequipped:connect(Finale)
  833. Finale()
  834. end))
  835. LocalScript20.Name = "BackupWeld"
  836. LocalScript20.Parent = Tool0
  837. table.insert(cors,sandbox(LocalScript20,function()
  838. function Weld(x,y)
  839. local W = Instance.new("Weld")
  840. W.Part0 = x
  841. W.Part1 = y
  842. local CJ = CFrame.new(x.Position)
  843. local C0 = x.CFrame:inverse()*CJ
  844. local C1 = y.CFrame:inverse()*CJ
  845. W.C0 = C0
  846. W.C1 = C1
  847. W.Parent = x
  848. end
  849.  
  850. function Get(A)
  851. if A.className == "Part" then
  852. Weld(script.Parent.Handle, A)
  853. A.Anchored = false
  854. else
  855. local C = A:GetChildren()
  856. for i=1, #C do
  857. Get(C[i])
  858. end
  859. end
  860. end
  861.  
  862. function Finale()
  863. Get(script.Parent)
  864. end
  865.  
  866. script.Parent.Equipped:connect(Finale)
  867. script.Parent.Unequipped:connect(Finale)
  868. Finale()
  869. end))
  870. LocalScript21.Name = "BackupWeld"
  871. LocalScript21.Parent = Tool0
  872. table.insert(cors,sandbox(LocalScript21,function()
  873. function Weld(x,y)
  874. local W = Instance.new("Weld")
  875. W.Part0 = x
  876. W.Part1 = y
  877. local CJ = CFrame.new(x.Position)
  878. local C0 = x.CFrame:inverse()*CJ
  879. local C1 = y.CFrame:inverse()*CJ
  880. W.C0 = C0
  881. W.C1 = C1
  882. W.Parent = x
  883. end
  884.  
  885. function Get(A)
  886. if A.className == "Part" then
  887. Weld(script.Parent.Handle, A)
  888. A.Anchored = false
  889. else
  890. local C = A:GetChildren()
  891. for i=1, #C do
  892. Get(C[i])
  893. end
  894. end
  895. end
  896.  
  897. function Finale()
  898. Get(script.Parent)
  899. end
  900.  
  901. script.Parent.Equipped:connect(Finale)
  902. script.Parent.Unequipped:connect(Finale)
  903. Finale()
  904. end))
  905. LocalScript22.Name = "BackupWeld"
  906. LocalScript22.Parent = Tool0
  907. table.insert(cors,sandbox(LocalScript22,function()
  908. function Weld(x,y)
  909. local W = Instance.new("Weld")
  910. W.Part0 = x
  911. W.Part1 = y
  912. local CJ = CFrame.new(x.Position)
  913. local C0 = x.CFrame:inverse()*CJ
  914. local C1 = y.CFrame:inverse()*CJ
  915. W.C0 = C0
  916. W.C1 = C1
  917. W.Parent = x
  918. end
  919.  
  920. function Get(A)
  921. if A.className == "Part" then
  922. Weld(script.Parent.Handle, A)
  923. A.Anchored = false
  924. else
  925. local C = A:GetChildren()
  926. for i=1, #C do
  927. Get(C[i])
  928. end
  929. end
  930. end
  931.  
  932. function Finale()
  933. Get(script.Parent)
  934. end
  935.  
  936. script.Parent.Equipped:connect(Finale)
  937. script.Parent.Unequipped:connect(Finale)
  938. Finale()
  939. end))
  940. LocalScript23.Name = "AnimateScript"
  941. LocalScript23.Parent = Tool0
  942. table.insert(cors,sandbox(LocalScript23,function()
  943. ------------------------------------------------------WeldArm---------------------------------------------------------------
  944. Tool = script.Parent;
  945. local arms = nil
  946. local torso = nil
  947. local welds = {}
  948. local neck = nil
  949. local orginalC0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  950.  
  951. function Equip(mouse)
  952. wait(0.01)
  953. arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
  954. head = Tool.Parent:FindFirstChild("Head")
  955. torso = Tool.Parent:FindFirstChild("Torso")
  956. if neck == nil then
  957. neck = Tool.Parent:FindFirstChild("Torso").Neck
  958. end
  959. if arms ~= nil and torso ~= nil then
  960. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  961. if sh ~= nil then
  962. local yes = true
  963. if yes then
  964. yes = false
  965. sh[1].Part1 = nil
  966. sh[2].Part1 = nil
  967. local weld1 = Instance.new("Weld")
  968. weld1.Name = "weld1"
  969. weld1.Part0 = head
  970. weld1.Parent = head
  971. weld1.Part1 = arms[1]
  972. welds[1] = weld1
  973. local weld2 = Instance.new("Weld")
  974. weld2.Name = "weld2"
  975. weld2.Part0 = head
  976. weld2.Parent = head
  977. weld2.Part1 = arms[2]
  978. welds[2] = weld2
  979. -------------------------here
  980. weld1.C1 = CFrame.new(0.7, 0.9, -1) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(28), math.rad(-1)) ---The first set of numbers changes where the arms move to the second set changes their angles
  981. weld2.C1 = CFrame.new(-0.6, 0, -1) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-0.01), 0) --- Same as top
  982. mouse.Move:connect(function ()
  983. --local Direction = Tool.Direction.Value
  984. local Direction = mouse.Hit.p
  985. local b = head.Position.Y-Direction.Y
  986. local dist = (head.Position-Direction).magnitude
  987. local answer = math.asin(b/dist)
  988. neck.C0=orginalC0*CFrame.fromEulerAnglesXYZ(answer,0,0)
  989. wait(0.1)
  990. end)
  991. end
  992. else
  993. print("sh")
  994. end
  995. else
  996. print("arms")
  997. end
  998. end
  999.  
  1000. function Unequip(mouse)
  1001. if arms ~= nil and torso ~= nil then
  1002.  
  1003. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  1004. if sh ~= nil then
  1005. local yes = true
  1006. if yes then
  1007. neck.C0 = orginalC0
  1008. yes = false
  1009. sh[1].Part1 = arms[1]
  1010. sh[2].Part1 = arms[2]
  1011. welds[1].Parent = nil
  1012. welds[2].Parent = nil
  1013. end
  1014. else
  1015. print("sh")
  1016. end
  1017. else
  1018. print("arms")
  1019. end
  1020. end
  1021. Tool.Equipped:connect(Equip)
  1022. Tool.Unequipped:connect(Unequip)
  1023. end))
  1024. Script24.Name = "SpinningScript"
  1025. Script24.Parent = Tool0
  1026. table.insert(cors,sandbox(Script24,function()
  1027. --[[
  1028.  
  1029. This is a script that makes an anchored brick rotate!
  1030. Just resize the brick to your desired size!
  1031. This script was made by ProjectTwo
  1032. Free for anyone to use!
  1033. ]]
  1034. while true do
  1035. wait()
  1036. script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0, math.pi/100, 0)
  1037. end
  1038.  
  1039. end))
  1040. Weld25.Parent = Script24
  1041. for i,v in pairs(mas:GetChildren()) do
  1042. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  1043. pcall(function() v:MakeJoints() end)
  1044. end
  1045. mas:Destroy()
  1046. for i,v in pairs(cors) do
  1047. spawn(function()
  1048. pcall(v)
  1049. end)
  1050. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement