Advertisement
Kaemi

Untitled

Dec 6th, 2016
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.38 KB | None | 0 0
  1. --Regular Script!
  2.  
  3. Name = "kaemi"
  4. Colors = {"teal", "teal"}
  5. Plrs = game:GetService("Players")
  6.  
  7. me = Plrs[Name]
  8. char = me.Character
  9. Modelname = "xGun"
  10. Toolname = "xGun"
  11. Surfaces = {"FrontSurface", "BackSurface", "TopSurface", "BottomSurface", "LeftSurface", "RightSurface"}
  12. necko = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  13. selected = false
  14. Hurt = false
  15. Deb = true
  16. Able = true
  17. Prop = {Damage = 30}
  18.  
  19. ToolIcon = ""
  20. MouseIc = ""
  21. MouseDo = ""
  22.  
  23. Add = {
  24. Sphere = function(P)
  25. local m = Instance.new("SpecialMesh",P)
  26. m.MeshType = "Sphere"
  27. return m
  28. end,
  29. BF = function(P)
  30. local bf = Instance.new("BodyForce",P)
  31. bf.force = Vector3.new(0, P:GetMass()*147, 0)
  32. return bf
  33. end,
  34. BP = function(P)
  35. local bp = Instance.new("BodyPosition",P)
  36. bp.maxForce = Vector3.new(math.huge, 0, math.huge)
  37. bp.P = 14000
  38. return bp
  39. end,
  40. BG = function(P)
  41. local bg = Instance.new("BodyGyro",P)
  42. bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  43. bg.P = 14000
  44. return bg
  45. end,
  46. Mesh = function(P, ID, x, y, z)
  47. local m = Instance.new("SpecialMesh")
  48. m.MeshId = ID
  49. m.Scale = Vector3.new(x, y, z)
  50. m.Parent = P
  51. return m
  52. end,
  53. Sound = function(P, ID, vol, pitch)
  54. local s = Instance.new("Sound")
  55. s.SoundId = ID
  56. s.Volume = vol
  57. s.Pitch = pitch
  58. s.Parent = P
  59. return s
  60. end
  61. }
  62.  
  63. function find(tab, arg)
  64. local ah = nil
  65. for i,v in pairs(tab) do
  66. if v == arg then
  67. ah = v
  68. end
  69. end
  70. return ah
  71. end
  72.  
  73. function getAllParts(from)
  74. local t = {}
  75. function getParts(where)
  76. for i, v in pairs(where:children()) do
  77. if v:IsA("BasePart") then
  78. if v.Parent ~= char and v.Parent.Parent ~= char then
  79. table.insert(t, v)
  80. end
  81. end
  82. getParts(v)
  83. end
  84. end
  85. getParts(workspace)
  86. return t
  87. end
  88.  
  89. function RayCast(pos1, pos2, maxDist, forward)
  90. local list = getAllParts(workspace)
  91. local pos0 = pos1
  92. for dist = 1, maxDist, forward do
  93. pos0 = (CFrame.new(pos1, pos2) * CFrame.new(0, 0, -dist)).p
  94. for _, v in pairs(list) do
  95. local pos3 = v.CFrame:pointToObjectSpace(pos0)
  96. local s = v.Size
  97. if pos3.x > -(s.x/2) and pos3.x < (s.x/2) and pos3.y > -(s.y/2) and pos3.y < (s.y/2) and pos3.z > -(s.z/2) and pos3.x < (s.z/2) and v.CanCollide == true then
  98. return pos0, v
  99. end
  100. end
  101. end
  102. return pos0, nil
  103. end
  104.  
  105. function Part(Parent, Anchor, Collide, Tran, Ref, Color, X, Y, Z, Break)
  106. local p = Instance.new("Part")
  107. p.formFactor = "Custom"
  108. p.Anchored = Anchor
  109. p.CanCollide = Collide
  110. p.Transparency = Tran
  111. p.Reflectance = Ref
  112. p.BrickColor = BrickColor.new(Color)
  113. for _, Surf in pairs(Surfaces) do
  114. p[Surf] = "Smooth"
  115. end
  116. p.Size = Vector3.new(X, Y, Z)
  117. if Break then
  118. p:BreakJoints()
  119. else p:MakeJoints() end
  120. p.Parent = Parent
  121. return p
  122. end
  123.  
  124. function Weld(p0, p1, x, y, z, a, b, c)
  125. local w = Instance.new("Weld")
  126. w.Parent = p0
  127. w.Part0 = p0
  128. w.Part1 = p1
  129. w.C1 = CFrame.new(x,y,z) * CFrame.Angles(a,b,c)
  130. return w
  131. end
  132.  
  133. function ComputePos(pos1, pos2)
  134. local pos3 = Vector3.new(pos2.x, pos1.y, pos2.z)
  135. return CFrame.new(pos1, pos3)
  136. end
  137.  
  138. function getHumanoid(c)
  139. local h = nil
  140. for i,v in pairs(c:children()) do
  141. if v:IsA("Humanoid") and c ~= char then
  142. if v.Health > 0 then
  143. h = v
  144. end
  145. end
  146. end
  147. return h
  148. end
  149.  
  150. for i,v in pairs(char:children()) do
  151. if v.Name == Modelname then
  152. v:remove()
  153. end
  154. end
  155.  
  156. torso = char.Torso
  157. neck = torso.Neck
  158. hum = char.Humanoid
  159. Rarm = char["Right Arm"]
  160. Larm = char["Left Arm"]
  161. Rleg = char["Right Leg"]
  162. Lleg = char["Left Leg"]
  163.  
  164. hc = Instance.new("Humanoid")
  165. hc.Health = 0
  166. hc.MaxHealth = 0
  167.  
  168. slash = Add.Sound(nil, "rbxasset://sounds//swordslash.wav", 0.9, 0.8)
  169. hitsound = Add.Sound(nil, "http://www.roblox.com/asset/?id=2801263", 0.7, 0.6)
  170. charge = Add.Sound(nil, "http://www.roblox.com/asset/?id=2101137", 0.8, 0.65)
  171. boom = Add.Sound(nil, "http://www.roblox.com/asset/?id=2691586", 0.8, 0.3)
  172. smashsound = Add.Sound(nil, "http://www.roblox.com/asset/?id=2692806", 0.8, 0.35)
  173. boomboom = Add.Sound(nil, "http://www.roblox.com/asset/?id=2760979", 1, 0.18)
  174.  
  175. function PlaySound(sound, pitch, vol)
  176. local s = sound:clone()
  177. if pitch ~= nil then
  178. if tonumber(pitch) then
  179. s.Pitch = tonumber(pitch)
  180. end
  181. end
  182. if vol ~= nil then
  183. if tonumber(vol) then
  184. s.Volume = tonumber(vol)
  185. end
  186. end
  187. s.Parent = torso
  188. s.PlayOnRemove = true
  189. coroutine.resume(coroutine.create(function()
  190. wait()
  191. s:remove()
  192. end))
  193. end
  194.  
  195. Mo = Instance.new("Model")
  196. Mo.Name = Modelname
  197.  
  198. RABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  199. LABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  200. RLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  201. LLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  202.  
  203. RABW = Weld(torso, RABrick, -1.5, -0.5, 0, 0, 0, 0)
  204. LABW = Weld(torso, LABrick, 1.5, -0.5, 0, 0, 0, 0)
  205. RLBW = Weld(torso, RLBrick, -0.5, 1.2, 0, 0, 0, 0)
  206. LLBW = Weld(torso, LLBrick, 0.5, 1.2, 0, 0, 0, 0)
  207.  
  208. RAW = Weld(RABrick, nil, 0, 0.5, 0, 0, 0, 0)
  209. LAW = Weld(LABrick, nil, 0, 0.5, 0, 0, 0, 0)
  210. RLW = Weld(RLBrick, nil, 0, 0.8, 0, 0, 0, 0)
  211. LLW = Weld(LLBrick, nil, 0, 0.8, 0, 0, 0, 0)
  212.  
  213. HB = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  214. HBW = Weld(Rarm, HB, 0, 1, 0, 0, 0, 0)
  215. HW = Weld(HB, nil, 0, -0.2, 0, math.pi/2, 0, 0)
  216.  
  217. TH = Weld(torso, nil, -0.3, -0.25, 1.5, math.rad(-60), 0, math.rad(-45))
  218. THMain = TH.C1
  219.  
  220. BG = Add.BG(nil)
  221.  
  222. RAWStand, LAWStand, RLWStand, LLWStand, HWStand, NeckStand = nil
  223.  
  224. handle = Part(Mo, false, false, 0, 0, Colors[2], 0.6, 1.6, 0.6, true)
  225. Instance.new("SpecialMesh",handle)
  226. handle.Name = "Handle"
  227.  
  228. tip1 = Part(Mo, false, false, 0, 0, Colors[2], 1, 0.8, 1, true)
  229. Instance.new("SpecialMesh",tip1)
  230. Weld(handle, tip1, 0, -0.1, 1, math.rad(-90), 0, 0)
  231.  
  232. tip2 = Part(Mo, false, false, 0, 0, Colors[2], 0.6, 0.8, 0.6, true)
  233. Instance.new("SpecialMesh",tip2)
  234. Weld(tip1, tip2, 0, -0.4, 0, 0, 0, 0)
  235.  
  236. tip3 = Part(Mo, false, false, 0, 0, Colors[2], 1.2, 0.3, 1.2, true)
  237. Instance.new("CylinderMesh",tip3)
  238. Weld(tip2, tip3, 0, -0.3, 0, 0, 0, 0)
  239.  
  240. for i = 0, 360, 22.5 do
  241. local tip4 = Part(Mo, false, false, 0, 0, Colors[1], 0.2, 1, 0.2, true)
  242. Instance.new("BlockMesh",tip4).Scale = Vector3.new(1, 1, 0.9)
  243. local w = Weld(tip3, tip4, -0.35, 0, 0, 0, 0, 0)
  244. w.C0 = CFrame.new(0, 0.65, 0) * CFrame.Angles(0, math.rad(i), 0)
  245. local tip5 = Part(Mo, false, false, 0, 0, Colors[2], 0.35, 0.2, 0.25, true)
  246. Instance.new("BlockMesh",tip5)
  247. local w2 = Weld(tip4, tip5, -0.05, -0.6, 0, 0, 0, 0)
  248. local tip7 = Part(Mo, false, false, 0, 0, Colors[2], 0.2, 0.4, 0.2, true)
  249. Instance.new("BlockMesh",tip7).Scale = Vector3.new(1, 1, 1)
  250. Weld(tip5, tip7, 0.1, -0.3, 0, 0, 0, 0)
  251. local tip8 = Part(Mo, false, false, 0, 0, Colors[2], 0.35, 0.2, 0.25, true)
  252. Instance.new("BlockMesh",tip8)
  253. Weld(tip5, tip8, 0, -0.5, 0, 0, 0, 0)
  254. end
  255.  
  256. for i = 0, 360, 90 do
  257. local tip6 = Part(Mo, false, false, 0, 0, Colors[2], 0.2, 1, 0.2, true)
  258. Instance.new("BlockMesh",tip6)
  259. local w = Weld(tip3, tip6, -0.45, 0, 0, 0, 0, 0)
  260. w.C0 = CFrame.new(0, 0.65, 0) * CFrame.Angles(0, math.rad(i), 0)
  261. end
  262.  
  263.  
  264. Mo.Parent = char
  265. TH.Part1 = handle
  266.  
  267. if script.Parent.className ~= "HopperBin" then
  268. h = Instance.new("HopperBin",me.Backpack)
  269. h.Name = Toolname
  270. h.TextureId = ToolIcon
  271. script.Parent = h
  272. end
  273.  
  274. bin = script.Parent
  275.  
  276. function detach(bool)
  277. LLW.C0 = CFrame.new(0, 0, 0)
  278. RLW.C0 = CFrame.new(0, 0, 0)
  279. LAW.C0 = CFrame.new(0, 0, 0)
  280. RAW.C0 = CFrame.new(0, 0, 0)
  281. if bool then
  282. LLW.Part1 = nil
  283. RLW.Part1 = nil
  284. RAW.Part1 = nil
  285. LAW.Part1 = nil
  286. TH.Part1 = handle
  287. HW.Part1 = nil
  288. end
  289. end
  290.  
  291. function attach()
  292. RAW.Part1 = Rarm
  293. LAW.Part1 = Larm
  294. RLW.Part1 = Rleg
  295. LLW.Part1 = Lleg
  296. end
  297.  
  298. function normal()
  299. neck.C0 = NeckStand
  300. RAW.C0 = RAWStand
  301. LAW.C0 = LAWStand
  302. RLW.C0 = RLWStand
  303. LLW.C0 = LLWStand
  304. RAW.C1 = CFrame.new(0, 0.5, 0)
  305. LAW.C1 = CFrame.new(0, 0.5, 0)
  306. RLW.C1 = CFrame.new(0, 0.8, 0)
  307. LLW.C1 = CFrame.new(0, 0.8, 0)
  308. HW.C0 = HWStand
  309. end
  310.  
  311. function idleanim()
  312. attach()
  313. for i = 0, 1, 0.03 do
  314. RAW.C0 = RAWStand * CFrame.Angles(0, 0, 0)
  315. LAW.C0 = LAWStand * CFrame.Angles(0, 0, 0)
  316. RLW.C0 = RLWStand * CFrame.Angles(0, 0, 0)
  317. LLW.C0 = LLWStand * CFrame.Angles(0, 0, 0)
  318. neck.C0 = NeckStand * CFrame.Angles(0, 0, 0)
  319. if selected == false or torso.Velocity.magnitude > 2 or Able == false then break end
  320. wait()
  321. end
  322. wait()
  323. for i = 1, 0, -0.02 do
  324. RAW.C0 = RAWStand * CFrame.Angles(0, 0, 0)
  325. LAW.C0 = LAWStand * CFrame.Angles(0, 0, 0)
  326. RLW.C0 = RLWStand * CFrame.Angles(0, 0, 0)
  327. LLW.C0 = LLWStand * CFrame.Angles(0, 0, 0)
  328. neck.C0 = NeckStand * CFrame.Angles(0, 0, 0)
  329. if selected == false or torso.Velocity.magnitude > 2 or Able == false then break end
  330. wait()
  331. end
  332. normal()
  333. end
  334.  
  335. function runanim()
  336. RLW.Part1 = nil
  337. LLW.Part1 = nil
  338. end
  339.  
  340. --[[coroutine.resume(coroutine.create(function()
  341. while true do
  342. wait()
  343. if selected and Able == true then
  344. if torso.Velocity.magnitude < 2 then
  345. idleanim()
  346. wait()
  347. else
  348. runanim()
  349. wait()
  350. end
  351. end
  352. end
  353. end))]]
  354.  
  355. function selectanim()
  356. RAW.Part1 = Rarm
  357. for i = 0, 1, 0.14 do
  358. RAW.C0 = CFrame.Angles(math.rad(100*i), math.rad(-10*i), math.rad(-70*i)) * CFrame.new(0.6*i, -1*i, 0)
  359. neck.C0 = necko * CFrame.Angles(math.rad(-25*i), 0, math.rad(30*i))
  360. wait()
  361. end
  362. HW.C0 = CFrame.Angles(0, math.rad(70), math.rad(40)) * CFrame.new(0, 0, -0.8)
  363. HW.Part1 = handle
  364. TH.Part1 = nil
  365. LAW.Part1 = Larm
  366. for i = 0, 1, 0.14 do
  367. RAW.C0 = CFrame.Angles(math.rad(100), math.rad(-10-15*i), math.rad(-70+60*i)) * CFrame.new(0.6-0.6*i, -1+1*i, 0)
  368. LAW.C0 = CFrame.Angles(math.rad(35*i), math.rad(20*i), math.rad(-25*i))
  369. neck.C0 = necko * CFrame.Angles(math.rad(-25+5*i), 0, math.rad(30-55*i))
  370. HW.C0 = CFrame.Angles(0, math.rad(70-70*i), math.rad(40+80*i)) * CFrame.new(0, 0, -0.8+0.6*i)
  371. wait()
  372. end
  373. for i = 0, 1, 0.1 do
  374. RAW.C0 = CFrame.Angles(math.rad(100-10*i), math.rad(-10-15+25*i), math.rad(-10+55*i)) * CFrame.new(-0.8*i, 0, 0.05*i)
  375. LAW.C0 = CFrame.Angles(math.rad(35+55*i), math.rad(20-20*i), math.rad(-25+90*i)) * CFrame.new(-0.3*i, -1.2*i, 0)
  376. neck.C0 = necko * CFrame.Angles(math.rad(-20+20*i), 0, math.rad(30-55-20*i))
  377. HW.C0 = CFrame.Angles(0, 0, math.rad(120+60*i)) * CFrame.new(0, 0, -0.2+0.6*i)
  378. wait()
  379. end
  380. if RAWStand == nil then
  381. RAWStand = RAW.C0
  382. LAWStand = LAW.C0
  383. RLWStand = RLW.C0
  384. LLWStand = LLW.C0
  385. HWStand = HW.C0
  386. NeckStand = neck.C0
  387. end
  388. BG.Parent = torso
  389. end
  390.  
  391. function deselanim()
  392. BG.Parent = nil
  393. for i = 1, 0, -0.1 do
  394. RAW.C0 = CFrame.Angles(math.rad(100-10*i), math.rad(-10-15+25*i), math.rad(-10+55*i)) * CFrame.new(-0.8*i, 0, 0.05*i)
  395. LAW.C0 = CFrame.Angles(math.rad(35+55*i), math.rad(20-20*i), math.rad(-25+90*i)) * CFrame.new(-0.3*i, -1.2*i, 0)
  396. neck.C0 = necko * CFrame.Angles(math.rad(-20+20*i), 0, math.rad(30-55-20*i))
  397. HW.C0 = CFrame.Angles(0, 0, math.rad(120+60*i)) * CFrame.new(0, 0, -0.2+0.6*i)
  398. wait()
  399. end
  400. for i = 1, 0, -0.14 do
  401. RAW.C0 = CFrame.Angles(math.rad(100), math.rad(-10-15*i), math.rad(-70+60*i)) * CFrame.new(0.6-0.6*i, -1+1*i, 0)
  402. LAW.C0 = CFrame.Angles(math.rad(35*i), math.rad(20*i), math.rad(-25*i))
  403. neck.C0 = necko * CFrame.Angles(math.rad(-25+5*i), 0, math.rad(30-55*i))
  404. HW.C0 = CFrame.Angles(0, math.rad(70-70*i), math.rad(40+80*i)) * CFrame.new(0, 0, -0.8+0.6*i)
  405. wait()
  406. end
  407. HW.Part1 = nil
  408. LAW.Part1 = nil
  409. TH.Part1 = handle
  410. for i = 1, 0, -0.14 do
  411. RAW.C0 = CFrame.Angles(math.rad(100*i), math.rad(-10*i), math.rad(-70*i)) * CFrame.new(0.6*i, -1*i, 0)
  412. neck.C0 = necko * CFrame.Angles(math.rad(-25*i), 0, math.rad(30*i))
  413. wait()
  414. end
  415. neck.C0 = necko
  416. detach(true)
  417. end
  418.  
  419. function fire()
  420. local ball = Part(workspace, false, false, 0, 0, Colors[1], 1, 1, 1, true)
  421. Add.BF(ball)
  422. Add.Sphere(ball)
  423. ball.CFrame = tip1.CFrame * CFrame.new(0, 1.5, 0)
  424. local cf = CFrame.new(handle.Position, handle.CFrame * CFrame.new(0, 0, -5).p)
  425. ball.Velocity = cf.lookVector * -80
  426. local w1, w2, w3 = RAW.C0, LAW.C0
  427. for i = 0, 1, 0.5 do
  428. RAW.C0 = w1 * CFrame.Angles(math.rad(25*i), 0, 0)
  429. LAW.C0 = w2 * CFrame.Angles(math.rad(25*i), 0, 0)
  430. HW.C0 = HWStand * CFrame.Angles(math.rad(-20*i), 0, 0)
  431. wait()
  432. end
  433. for i = 1, 0, -0.2 do
  434. RAW.C0 = w1 * CFrame.Angles(math.rad(25*i), 0, 0)
  435. LAW.C0 = w2 * CFrame.Angles(math.rad(25*i), 0, 0)
  436. HW.C0 = HWStand * CFrame.Angles(math.rad(-20*i), 0, 0)
  437. wait()
  438. end
  439. end
  440.  
  441.  
  442. function select(mouse)
  443. selectanim()
  444. selected = true
  445. mouse.KeyDown:connect(function(key)
  446. key = key:lower()
  447. if key == "q" then
  448. end
  449. end)
  450. local hold = false
  451. mouse.Button1Down:connect(function()
  452. hold = true
  453. coroutine.resume(coroutine.create(function()
  454. mouse.Button1Up:wait()
  455. hold = false
  456. end))
  457. while hold do
  458. local pos = torso.CFrame * CFrame.new(0, 0.85, 0).p
  459. local offset = (pos.Y - mouse.Hit.p.Y) / 60
  460. local mag = (pos - mouse.Hit.p).magnitude / 80
  461. offset = offset / mag
  462. if offset > 1 then offset = 1 elseif offset < -1 then offset = -1 end
  463. RAW.C0 = RAWStand * CFrame.Angles(-offset, 0, 0) * CFrame.new(0, 0, 0)
  464. LAW.C0 = LAWStand * CFrame.Angles(-offset/1.5, 0, offset/5) * CFrame.new(0, 0, 0)
  465. neck.C0 = NeckStand * CFrame.Angles(offset/1.6, 0, 0)
  466. wait()
  467. end
  468. fire()
  469. LAW.C0 = LAWStand
  470. RAW.C0 = RAWStand
  471. neck.C0 = NeckStand
  472. end)
  473. while selected do
  474. BG.cframe = ComputePos(torso.Position, mouse.Hit.p) * CFrame.Angles(0, math.rad(45), 0)
  475. wait()
  476. end
  477. end
  478.  
  479. function deselect(mouse)
  480. selected = false
  481. deselanim()
  482. end
  483.  
  484. bin.Selected:connect(select)
  485. bin.Deselected:connect(deselect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement