Advertisement
mathmasterphil

Paintball

Mar 4th, 2015
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.43 KB | None | 0 0
  1. Plrs = game:GetService("Players")
  2. me = Plrs.LocalPlayer
  3. char = me.Character
  4. Modelname = "TagGun"
  5. Toolname = "Gun"
  6. Able = true
  7. Selected = false
  8. Crouching = false
  9. Charging = false
  10. Throwing = false
  11. ShootAnim = false
  12. Smashing = false
  13. SmashDmg = 60
  14. MaxGrenades = 6
  15. Grenades = MaxGrenades
  16. GrenadeDist = 18
  17. GrenadePower = (GrenadeDist*100)/3
  18. GrenadeTime = 3.8
  19. ReflectMax = 7
  20. ReflectMin = 3
  21. MaxCharge = 200
  22. Charge = MaxCharge
  23. ChargeCost = 25
  24. GiveCharge = MaxCharge/8
  25. Dmg = 55
  26. Accuracy = 2
  27. Debounce = 1.4
  28. MouseIc = "http://www.roblox.com/asset/?id=50054737"
  29. MouseRe = "http://www.roblox.com/asset/?id=50055025"
  30. MousePi = "http://www.roblox.com/asset/?id=50055031"
  31. function Notime(func, tim)
  32. coroutine.resume(coroutine.create(function()
  33. if tim then
  34. wait(tim)
  35. end
  36. func()
  37. end))
  38. end
  39. function waitChild(parent, name)
  40. local child = parent:findFirstChild(name)
  41. if child then return child end
  42. while true do
  43. child = parent.ChildAdded:wait()
  44. if child.Name == name then return child end
  45. end
  46. end
  47. Add = {
  48. Sphere = function(P)
  49. local m = Instance.new("SpecialMesh",P)
  50. m.MeshType = "Sphere"
  51. return m
  52. end,
  53. BF = function(P)
  54. local bf = Instance.new("BodyForce",P)
  55. bf.force = Vector3.new(0, P:GetMass()*187, 0)
  56. return bf
  57. end,
  58. BP = function(P)
  59. local bp = Instance.new("BodyPosition",P)
  60. bp.maxForce = Vector3.new(math.huge, 0, math.huge)
  61. bp.P = 14000
  62. return bp
  63. end,
  64. BG = function(P)
  65. local bg = Instance.new("BodyGyro",P)
  66. bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  67. bg.P = 14000
  68. return bg
  69. end,
  70. Mesh = function(P, ID, x, y, z)
  71. local m = Instance.new("SpecialMesh")
  72. m.MeshId = ID
  73. m.Scale = Vector3.new(x, y, z)
  74. m.Parent = P
  75. return m
  76. end,
  77. Sound = function(P, ID, vol, pitch)
  78. local s = Instance.new("Sound")
  79. s.SoundId = ID
  80. s.Volume = vol
  81. s.Pitch = pitch
  82. s.Parent = P
  83. return s
  84. end
  85. }
  86. function ComputePos(pos1, pos2)
  87. local pos3 = Vector3.new(pos2.x, pos1.y, pos2.z)
  88. return CFrame.new(pos1, pos3)
  89. end
  90. function Part(Parent, Anchor, Collide, Tran, Ref, Color, X, Y, Z, Break)
  91. local p = Instance.new("Part")
  92. p.formFactor = "Custom"
  93. p.Anchored = Anchor
  94. p.CanCollide = Collide
  95. p.Transparency = Tran
  96. p.Reflectance = Ref
  97. p.BrickColor = BrickColor.new(Color)
  98. p.TopSurface = 0
  99. p.BottomSurface = 0
  100. p.Size = Vector3.new(X, Y, Z)
  101. if Break then
  102. p:BreakJoints()
  103. else p:MakeJoints() end
  104. p.Parent = Parent
  105. return p
  106. end
  107. function Weld(p0, p1, x, y, z, a, b, c)
  108. local w = Instance.new("Weld")
  109. w.Parent = p0
  110. w.Part0 = p0
  111. w.Part1 = p1
  112. w.C1 = CFrame.new(x,y,z) * CFrame.Angles(a,b,c)
  113. return w
  114. end
  115. function getHumanoid(c)
  116. local h = nil
  117. for i,v in pairs(c:children()) do
  118. if v:IsA("Humanoid") and c ~= char then
  119. if v.Health > 0 then
  120. h = v
  121. end
  122. end
  123. end
  124. return h
  125. end
  126. function getCharacters(where, pos, dist)
  127. local chars = {}
  128. for _, v in pairs(where:children()) do
  129. local hum = getHumanoid(v)
  130. local tors = v:findFirstChild("Torso")
  131. if tors ~= nil and hum ~= nil then
  132. local anypart = nil
  133. for _,k in pairs(v:children()) do
  134. if k:IsA("BasePart") then
  135. if (k.Position - pos).magnitude <= dist then
  136. anypart = k
  137. break
  138. end
  139. end
  140. end
  141. if anypart then
  142. table.insert(chars, {v, tors, hum})
  143. end
  144. end
  145. end
  146. return chars
  147. end
  148. Gawnz = Instance.new("Model",workspace.Base)
  149. Gawnz.Name = "Gawnz"
  150. function RC(Pos, Dir, Max, Ignore)
  151. return workspace:FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999)), Ignore)
  152. end
  153. function Draw(Pos1, Pos2)
  154. local mag = (Pos1 - Pos2).magnitude
  155. local line = Part(Gawnz, true, false, 0, 0, tostring(me.TeamColor), 0.2, 0.2, 1, true)
  156. line.CFrame = CFrame.new(Pos1, Pos2) * CFrame.new(0, 0, -mag/2)
  157. local mesh = Instance.new("SpecialMesh",line)
  158. mesh.MeshType = "Brick"
  159. mesh.Scale = Vector3.new(1, 1, mag)
  160. Notime(function()
  161. for i = 0, 1, 0.33 do
  162. wait()
  163. line.Transparency = i
  164. end
  165. line:remove()
  166. end)
  167. end
  168. Lazors = {
  169. {"http://www.roblox.com/asset/?id=22968437", 2.6},
  170. {"http://www.roblox.com/asset?id=1369158", 4.4},
  171. {"http://www.roblox.com/asset/?id=13775480", 1.4}
  172. }
  173. Mirroring = {
  174. {"http://www.roblox.com/asset/?id=12222124", 7.5},
  175. }
  176. function PlaySound(id, pitch, vol)
  177. local s = Add.Sound(nil, id, vol, pitch)
  178. if pitch ~= nil then
  179. if tonumber(pitch) then
  180. s.Pitch = tonumber(pitch)
  181. end
  182. end
  183. if vol ~= nil then
  184. if tonumber(vol) then
  185. s.Volume = tonumber(vol)
  186. end
  187. end
  188. s.Parent = torso
  189. s.PlayOnRemove = true
  190. Notime(function()
  191. wait()
  192. s:remove()
  193. end)
  194. end
  195. function Playz(tab, vol, pitch1)
  196. local pick = tab[math.random(1, #tab)]
  197. local id, pitch = pick[1], pick[2]
  198. PlaySound(id, math.random(pitch-pitch1, pitch+pitch1), vol)
  199. end
  200. function EndEffect(pos)
  201. local p = Part(Gawnz, true, false, 0.1, 0, me.TeamColor.Name, 1, 1, 1, true)
  202. p.CFrame = CFrame.new(pos)
  203. local sp = Add.Sphere(p)
  204. Notime(function()
  205. for i = 0, 1, 0.1 do
  206. sp.Scale = Vector3.new(0.4+1.2*i, 0.4+1.2*i, 0.4+1.2*i)
  207. p.Transparency = 0.1+0.9*i
  208. wait()
  209. end
  210. p:remove()
  211. end)
  212. end
  213. torso = waitChild(char, "Torso")
  214. head = waitChild(char, "Head")
  215. neck = waitChild(torso, "Neck")
  216. hum = waitChild(char, "Humanoid")
  217. Rarm = waitChild(char, "Right Arm")
  218. Larm = waitChild(char, "Left Arm")
  219. Rleg = waitChild(char, "Right Leg")
  220. Lleg = waitChild(char, "Left Leg")
  221. RH = waitChild(torso, "Right Hip")
  222. LH = waitChild(torso, "Left Hip")
  223. RH.Part0 = torso
  224. LH.Part0 = torso
  225. for i,v in pairs(char:children()) do
  226. if v.Name == Modelname or v:IsA("Hat") or v:IsA("Pants") or v:IsA("Shirt") or v:IsA("CharacterMesh") then
  227. v:remove()
  228. end
  229. end
  230. PlrGui = waitChild(me, "PlayerGui")
  231. Sc = Instance.new("ScreenGui")
  232. Sc.Name = "LaserTagOptions"
  233. Main = Instance.new("Frame", Sc)
  234. Main.Size = UDim2.new(0, 150, 0, 350)
  235. Main.Position = UDim2.new(1, -150-10, 0.5, -350/2)
  236. Main.BackgroundColor3 = Color3.new(0.2, 0.1, 0.3)
  237. Main.BackgroundTransparency = 0.2
  238. ChargeBack = Instance.new("Frame", Main)
  239. ChargeBack.Size = UDim2.new(0, 40, 1, -40)
  240. ChargeBack.Position = UDim2.new(0, 10, 0, 10)
  241. ChargeBack.BorderSizePixel = 0
  242. ChargeBack.BackgroundColor3 = Color3.new(0, 0, 0)
  243. ChargeBack.BackgroundTransparency = 0.3
  244. GrenadeBack = ChargeBack:clone()
  245. GrenadeBack.Parent = Main
  246. GrenadeBack.Position = UDim2.new(1, -40-10, 0, 30)
  247. ChargeText = Instance.new("TextLabel", ChargeBack)
  248. ChargeText.Font = "ArialBold"
  249. ChargeText.FontSize = "Size18"
  250. ChargeText.TextXAlignment = "Left"
  251. ChargeText.TextYAlignment = "Top"
  252. ChargeText.Position = UDim2.new(0, 0, 1, 2)
  253. ChargeText.TextColor3 = Color3.new(1,1,1)
  254. ChargeText.BackgroundTransparency = 1
  255. ChargeText.Text = "Charge"
  256. ChargeBar = Instance.new("ImageLabel", ChargeBack)
  257. ChargeBar.Size = UDim2.new(1, -4, Charge/MaxCharge, -4)
  258. ChargeBar.Position = UDim2.new(0, 2, 0, 2)
  259. ChargeBar.BackgroundColor = BrickColor.new(me.TeamColor.Name)
  260. ChargeBar.Image = "http://www.roblox.com/asset/?id=50051953"
  261. ChargeBar.BackgroundTransparency = 0.25
  262. GrenadeBar = Instance.new("ImageLabel", GrenadeBack)
  263. GrenadeBar.Size = UDim2.new(1, -4, Grenades/MaxGrenades, -4)
  264. GrenadeBar.Position = UDim2.new(0, 2, 0, 2)
  265. GrenadeBar.BackgroundColor3 = Color3.new(1, 0.75, 0)
  266. GrenadeBar.Image = "http://www.roblox.com/asset/?id=50051953"
  267. GrenadeBar.BackgroundTransparency = 0.25
  268. CBT = Instance.new("TextLabel", ChargeBack)
  269. CBT.TextColor3 = Color3.new(0.85, 0.85, 0.85)
  270. CBT.BackgroundTransparency = 1
  271. CBT.Font = "ArialBold"
  272. CBT.FontSize = "Size14"
  273. CBT.Text = math.ceil((Charge/MaxCharge)*100).."%"
  274. CBT.Position = UDim2.new(0.5, 0, 0.5, 0)
  275. GBT = CBT:clone()
  276. GBT.TextColor3 = Color3.new(1, 1, 1)
  277. GBT.FontSize = "Size18"
  278. GBT.Text = Grenades
  279. GBT.Parent = GrenadeBack
  280. GrenadeText = ChargeText:clone()
  281. GrenadeText.Parent = GrenadeBack
  282. GrenadeText.Text = "Grenades"
  283. GrenadeText.TextYAlignment = "Bottom"
  284. GrenadeText.TextXAlignment = "Right"
  285. GrenadeText.Position = UDim2.new(1, 0, 0, -2)
  286. Fillscreen = Instance.new("TextLabel", Sc)
  287. Fillscreen.Visible = false
  288. Fillscreen.Size = UDim2.new(1, 0, 1, 1)
  289. Fillscreen.Position = UDim2.new(0, 0, 0, -1)
  290. Fillscreen.BackgroundColor3 = Color3.new()
  291. Fillscreen.TextColor3 = Color3.new(1, 1, 1)
  292. Fillscreen.Font = "ArialBold"
  293. Fillscreen.Text = "Zoom ALL WAY IN to play!"
  294. Fillscreen.FontSize = "Size48"
  295. Sc.Parent = PlrGui
  296. cam = workspace.CurrentCamera
  297. Mo = Instance.new("Model")
  298. Mo.Name = Modelname
  299. Faketorso = Part(Mo, false, false, 0, 0, tostring(torso.BrickColor), 2, 2, 1, true)
  300. Faketorso.Name = "FakeTorso"
  301. FakeArms = Instance.new("Model")
  302. local PR1 = Part(FakeArms, false, false, 0, 0, tostring(me.TeamColor), 0.2, 0.2, 0.2)
  303. Instance.new("SpecialMesh",PR1).Scale = Vector3.new(3.5, 8, 3.5)
  304. Weld(Rarm, PR1, -0.3, -0.4, 0, math.rad(10), 0, math.rad(-20))
  305. local PR2 = Part(FakeArms, false, false, 0, 0, tostring(Rarm.BrickColor), 0.2, 0.2, 0.2)
  306. Instance.new("SpecialMesh",PR2).Scale = Vector3.new(3.5, 6, 3.5)
  307. Weld(Rarm, PR2, -0.3, 0.4, 0, math.rad(-10), 0, math.rad(20))
  308. local PL1 = Part(FakeArms, false, false, 0, 0, tostring(me.TeamColor), 0.2, 0.2, 0.2)
  309. Instance.new("SpecialMesh",PL1).Scale = Vector3.new(3.5, 8, 3.5)
  310. Weld(Larm, PL1, 0.3, -0.4, 0, math.rad(10), 0, math.rad(20))
  311. local PL2 = Part(FakeArms, false, false, 0, 0, tostring(Larm.BrickColor), 0.2, 0.2, 0.2)
  312. Instance.new("SpecialMesh",PL2).Scale = Vector3.new(3.5, 6, 3.5)
  313. Weld(Larm, PL2, 0.3, 0.4, 0, math.rad(-10), 0, math.rad(-20))
  314. FakeArms.Parent = cam
  315. local TW = Weld(torso, Faketorso, 0, 0, 0, 0, 0, 0)
  316. torso.Transparency = 1
  317. RABrick = Part(Mo, false, false, 1, 0, "Lime green", 0.1, 0.1, 0.1, true)
  318. LABrick = Part(Mo, false, false, 1, 0, "Lime green", 0.1, 0.1, 0.1, true)
  319. RLBrick = Part(Mo, false, false, 1, 0, "Lime green", 0.1, 0.1, 0.1, true)
  320. LLBrick = Part(Mo, false, false, 1, 0, "Lime green", 0.1, 0.1, 0.1, true)
  321. RABW = Weld(Faketorso, RABrick, -1.5, -0.5, 0, 0, 0, 0)
  322. LABW = Weld(Faketorso, LABrick, 1.5, -0.5, 0, 0, 0, 0)
  323. RLBW = Weld(Faketorso, RLBrick, -0.5, 1.2, 0, 0, 0, 0)
  324. LLBW = Weld(Faketorso, LLBrick, 0.5, 1.2, 0, 0, 0, 0)
  325. RAW = Weld(RABrick, nil, 0, 0.5, 0, 0, 0, 0)
  326. LAW = Weld(LABrick, nil, 0, 0.5, 0, 0, 0, 0)
  327. RLW = Weld(RLBrick, nil, 0, 0.8, 0, 0, 0, 0)
  328. LLW = Weld(LLBrick, nil, 0, 0.8, 0, 0, 0, 0)
  329. HB = Part(Mo, false, false, 1, 0, "Lime green", 0.1, 0.1, 0.1, true)
  330. HBW = Weld(Rarm, HB, 0, 1, 0, 0, 0, 0)
  331. HW = Weld(HB, nil, -0.2, 0.5, 0.5, 0, 0, 0)
  332. Handle = Part(Gawnz, false, false, 0, 0, "Really black", 0.1, 0.1, 0.1, true)
  333. Handle.Name = "Handle"
  334. Add.Mesh(Handle, "rbxasset://fonts/PaintballGun.mesh", 1, 1, 1)
  335. HW.Part1 = Handle
  336. Mo.Parent = char
  337. RAW.Part1 = Rarm
  338. LAW.Part1 = Larm
  339. RH.Part0 = Faketorso
  340. LH.Part0 = Faketorso
  341. TW.C0 = CFrame.Angles(0, math.rad(-45), 0)
  342. RAWMain = CFrame.Angles(math.rad(90), 0, math.rad(-45)) * CFrame.new(0, -0.7, -0.02)
  343. LAWMain = CFrame.Angles(math.rad(90), 0, math.rad(40)) * CFrame.new(0, -0.6, -0.01)
  344. RAW.C0 = RAWMain
  345. LAW.C0 = LAWMain
  346. function FireAnim()
  347. ShootAnim = true
  348. local Place = RAW.C0
  349. local Place2 = HW.C0
  350. for i = 0, 1, 0.5 do
  351. RAW.C0 = Place * CFrame.new(0, 0.35*i, 0)
  352. HW.C0 = Place2 * CFrame.new(0, 0, 0.25*i)
  353. wait()
  354. end
  355. for i = 1, 0, -0.33 do
  356. RAW.C0 = Place * CFrame.new(0, 0.35*i, 0)
  357. HW.C0 = Place2 * CFrame.new(0, 0, 0.25*i)
  358. wait()
  359. end
  360. HW.C0 = Place2
  361. RAW.C0 = Place
  362. ShootAnim = false
  363. end
  364. function Fire(fro, t, max, bounce)
  365. local from = fro
  366. local to = t
  367. local a2, b2, c2 = math.random(-Accuracy*10, Accuracy*10)/10, math.random(-Accuracy*10, Accuracy*10)/10, math.random(-Accuracy*10, Accuracy*10)/10
  368. if Crouching then
  369. a2, b2, b3 = math.random(-Accuracy*10, Accuracy*10)/70, math.random(-Accuracy*10, Accuracy*10)/70, math.random(-Accuracy*10, Accuracy*10)/70
  370. end
  371. local cf = (CFrame.new(from, to) * CFrame.Angles(math.rad(a2), math.rad(a2), math.rad(a2)) * CFrame.new(0, 0, -4)).p
  372. local Hit, pos = RC(from, (cf - from), max, Gawnz)
  373. Draw(from, pos)
  374. EndEffect(pos)
  375. if Hit then
  376. if Hit.Parent:IsA("Hat") then
  377. Hit:breakJoints()
  378. end
  379. end
  380. local function dmg(p, dm)
  381. local h = nil
  382. if p then
  383. h = getHumanoid(p.Parent)
  384. if h then
  385. local realdmg = dm
  386. if p.Name == "Head" then
  387. realdmg = dm*2
  388. end
  389. h.Health = h.Health - realdmg
  390. end
  391. end
  392. return h
  393. end
  394. local h = nil
  395. if bounce then
  396. Notime(FireAnim)
  397. h = dmg(Hit, Dmg)
  398. Playz(Lazors, math.random(40,75)/100, 0.3)
  399. end
  400. Notime(function()
  401. if bounce and h == nil and Hit ~= nil then
  402. local mag = (from - to).magnitude
  403. local left = (max*1.5)-mag
  404. for _ = 1, math.random(ReflectMin,ReflectMax) do
  405. Playz(Mirroring, math.random(40,75)/100, 0.9)
  406. wait(mag/550)
  407. local a, b, c = math.random(-40, 40), math.random(-15, 15), math.random(-40, 40)
  408. to = (CFrame.new(pos, from) * CFrame.Angles(math.rad(a), math.rad(b), math.rad(c)) * CFrame.new(0, 0, -4)).p
  409. from = pos
  410. Hit, pos = Fire(from, to, max, false)
  411. mag = (from - to).magnitude
  412. left = left-mag
  413. local ha = dmg(Hit, Dmg)
  414. if left <= 0 or Hit == nil or ha ~= nil then break end
  415. end
  416. end
  417. end)
  418. return Hit, pos
  419. end
  420. if script.Parent.className ~= "Tool" then
  421. Tool = Instance.new("Tool", me.Backpack)
  422. Tool.Name = "Gun"
  423. script.Parent = Tool
  424. end
  425. bin = script.Parent
  426. CrouchR = RAWMain * CFrame.new(-0.5, -0.35, 0)
  427. CrouchL = LAWMain * CFrame.new(0, 0.3, 0)
  428. function Crouch()
  429. if Crouching == false then
  430. Crouching = true
  431. RH.Part1 = nil
  432. LH.Part1 = nil
  433. RLW.Part1 = Rleg
  434. LLW.Part1 = Lleg
  435. Rleg.CanCollide = true
  436. Lleg.CanCollide = true
  437. Rleg.Name = "Rcrouch"
  438. Lleg.Name = "Lcrouch"
  439. for i = 0, 1, 0.2 do
  440. RLW.C0 = CFrame.Angles(math.rad(5*i), 0, 0) * CFrame.new(0, 1.4*i, -1*i)
  441. LLW.C0 = CFrame.Angles(math.rad(-90*i), 0, 0) * CFrame.new(0, 0.3*i, 0.15*i)
  442. RAW.C0 = RAWMain * CFrame.new(-0.5*i, -0.35*i, 0)
  443. LAW.C0 = LAWMain * CFrame.new(0, 0.3*i, 0)
  444. wait()
  445. end
  446. else
  447. Crouching = false
  448. Rleg.Name = "Right Leg"
  449. Lleg.Name = "Left Leg"
  450. for i = 1, 0, -0.2 do
  451. RLW.C0 = CFrame.Angles(math.rad(10*i), 0, 0) * CFrame.new(0, 1.4*i, -1*i)
  452. LLW.C0 = CFrame.Angles(math.rad(-90*i), 0, 0) * CFrame.new(0, 0.3*i, 0.15*i)
  453. RAW.C0 = RAWMain * CFrame.new(-0.5*i, -0.35*i, 0)
  454. LAW.C0 = LAWMain * CFrame.new(0, 0.3*i, 0)
  455. wait()
  456. end
  457. RH.Part1 = Rleg
  458. LH.Part1 = Lleg
  459. RLW.Part1 = nil
  460. LLW.Part1 = nil
  461. Rleg.CanCollide = false
  462. Lleg.CanCollide = false
  463. end
  464. end
  465. function MakeGrenade()
  466. local grenade = Part(workspace, false, false, 0, 0, me.TeamColor.Name, 0.8, 1, 0.8, true)
  467. grenade.Friction = 0.8
  468. Add.Mesh(grenade, "http://www.roblox.com/Asset/?id=10207236", 0.15, 0.12, 0.15)
  469. local w = Weld(Larm, grenade, 0, 0, -1.25, 0, 0, 0)
  470. w.C0 = CFrame.Angles(math.pi/2, 0, 0)
  471. return grenade, w
  472. end
  473. function Throw(Mousepos)
  474. if Throwing == false and Grenades > 0 then
  475. Grenades = Grenades - 1
  476. Throwing = true
  477. for i = 0, 1, 0.25 do
  478. LAW.C0 = LAWMain * CFrame.Angles(math.rad(-85*i), 0, math.rad(30*i)) * CFrame.new(0, 0.2*i, 0.4*i)
  479. wait()
  480. end
  481. for i = 0, 1, 0.5 do
  482. LAW.C0 = LAWMain * CFrame.Angles(math.rad(-85), 0, math.rad(30)) * CFrame.new(0, 0.2-0.3*i, 0.4-0.5*i)
  483. wait()
  484. end
  485. local Gr, We = MakeGrenade()
  486. for i = 0, 1, 0.1 do
  487. LAW.C0 = LAWMain * CFrame.Angles(math.rad(-85+195*i), 0, math.rad(30-70*i)) * CFrame.new(0, -0.1+0.1*i, -0.1+0.1*i)
  488. wait()
  489. end
  490. We:remove()
  491. wait()
  492. local Mag = (torso.Position - Mousepos).magnitude
  493. Mag = Mag - (Mag/8)
  494. if Mag > 35 then Mag = 35 end
  495. local Power = (30+(Mag*1.5))
  496. Gr.Velocity = (CFrame.new(torso.Position, Mousepos) * CFrame.Angles(math.rad(20), 0, 0)).lookVector * Power
  497. Gr.CanCollide = true
  498. Notime(function()
  499. wait(GrenadeTime)
  500. local d = GrenadeDist
  501. local pos = Gr.Position
  502. local cf = CFrame.new(pos) * CFrame.Angles(math.rad(math.random(-180, 180)), math.rad(math.random(-180, 180)), math.rad(math.random(-180, 180)))
  503. Gr:remove()
  504. local eff = Instance.new("Model", workspace)
  505. eff.Name = "GrenadeEffect"
  506. local ball = Part(eff, true, false, 0, 0, me.TeamColor.Name, 1, 1, 1, true)
  507. ball.CFrame = cf
  508. local sp = Add.Sphere(ball)
  509. local ring = Part(eff, true, false, 0, 0, me.TeamColor.Name, 1, 1, 1, true)
  510. ring.CFrame = cf
  511. local rng = Add.Mesh(ring, "http://www.roblox.com/asset/?id=3270017", (d/2), (d/2), (d/2))
  512. local ring2 = Part(eff, true, false, 0, 0, me.TeamColor.Name, 1, 1, 1, true)
  513. ring2.CFrame = cf
  514. local rng2 = Add.Mesh(ring2, "http://www.roblox.com/asset/?id=3270017", (d/2), (d/2), (d/2))
  515. local ring3 = Part(eff, true, false, 0, 0, me.TeamColor.Name, 1, 1, 1, true)
  516. ring3.CFrame = cf
  517. local rng3 = Add.Mesh(ring3, "http://www.roblox.com/asset/?id=3270017", (d/2), (d/2), (d/2))
  518. Notime(function()
  519. PlaySound("http://www.roblox.com/asset/?id=2101148", 1.25, 0.6)
  520. for i = 0, 1, 0.065 do
  521. ball.Transparency = i
  522. sp.Scale = Vector3.new((d*2)*i, (d*2)*i, (d*2)*i)
  523. ring.Transparency = i
  524. ring2.Transparency = i
  525. ring3.Transparency = i
  526. rng.Scale = Vector3.new((d/2)+(d*2)*i, (d/2)+(d*2)*i, (d/2)+(d*2.8)*i)
  527. rng2.Scale = Vector3.new((d/2)+(d*2)*i, (d/2)+(d*2)*i, (d/2)+(d*2.8)*i)
  528. rng3.Scale = Vector3.new((d/2)+(d*2)*i, (d/2)+(d*2)*i, (d/2)+(d*2.8)*i)
  529. ring.CFrame = cf * CFrame.Angles(math.rad(180*i), 0, 0)
  530. ring2.CFrame = cf * CFrame.Angles(0, math.rad(180*i), 0)
  531. ring3.CFrame = cf * CFrame.Angles(0, math.rad(90*i), math.rad(180*i))
  532. wait()
  533. end
  534. eff:remove()
  535. end)
  536. local chars = getCharacters(workspace, pos, GrenadeDist)
  537. for _, v in pairs(chars) do
  538. local dist = (pos - v[2].Position).magnitude
  539. if dist < 1 then dist = 1 end
  540. local power = GrenadePower/dist
  541. v[3].Health = v[3].Health - power
  542. v[2].Velocity = CFrame.new(pos, v[2].Position).lookVector * 30
  543. end
  544. end)
  545. for i = 0, 1, 0.25 do
  546. LAW.C0 = LAWMain * CFrame.Angles(math.rad(110), 0, math.rad(-75-80*i)) * CFrame.new(0, -0.4*i, 0)
  547. wait()
  548. end
  549. for i = 0, 1, 0.33 do
  550. LAW.C0 = LAWMain * CFrame.Angles(math.rad(110-110), 0, math.rad(-155+155*i)) * CFrame.new(0, -0.4+0.4*i, 0)
  551. wait()
  552. end
  553. Throwing = false
  554. LAW.C0 = LAWMain
  555. end
  556. end
  557. function Reload()
  558. if Charging == false and Throwing == false and Charge < MaxCharge then
  559. Charging = true
  560. for i = 0, 1, 0.05 do
  561. RAW.C0 = CFrame.Angles(math.rad(90-35*i), 0, math.rad(-45+25*i)) * CFrame.new(-0.5*i, -0.7+0.9*i, -0.02)
  562. LAW.C0 = CFrame.Angles(math.rad(90-35*i), 0, math.rad(40+5*i)) * CFrame.new(0, -0.6-0.4*i, -0.01)
  563. wait()
  564. end
  565. repeat
  566. for i = 0, 1, 0.15 do
  567. RAW.C0 = CFrame.Angles(math.rad(90-35), 0, math.rad(-45+25)) * CFrame.new(-0.5, -0.7+0.9, -0.02)
  568. LAW.C0 = CFrame.Angles(math.rad(90-35+10*i), 0, math.rad(45-10*i)) * CFrame.new(0, -0.6-0.4-0.2*i, -0.01)
  569. wait()
  570. end
  571. PlaySound("rbxasset://sounds\\clickfast.wav", 2, 0.6)
  572. for i = 0, 1, 0.15 do
  573. RAW.C0 = CFrame.Angles(math.rad(90-35), 0, math.rad(-45+25)) * CFrame.new(-0.5, -0.7+0.9, -0.02)
  574. LAW.C0 = CFrame.Angles(math.rad(90-35+10-10*i), 0, math.rad(45-10+10*i)) * CFrame.new(0, -0.6-0.4-0.2+0.2*i, -0.01)
  575. wait()
  576. end
  577. PlaySound("rbxasset://sounds\\clickfast.wav", 2, 0.6)
  578. Charge = Charge + GiveCharge
  579. wait(0.08)
  580. until Charge >= MaxCharge-1
  581. for i = 0, 1, 0.1 do
  582. RAW.C0 = CFrame.Angles(math.rad(90-35+35*i), 0, math.rad(-45+25-25*i)) * CFrame.new(-0.5+0.5*i, -0.7+0.9-0.9*i, -0.02)
  583. LAW.C0 = CFrame.Angles(math.rad(90-35+35*i), 0, math.rad(40+5-5*i)) * CFrame.new(0, -0.6-0.4+0.4*i, -0.01)
  584. wait()
  585. end
  586. RAW.C0 = RAWMain
  587. LAW.C0 = LAWMain
  588. Charging = false
  589. end
  590. end
  591. function SmashGet()
  592. local chars = getCharacters(workspace, Handle.Position, 2)
  593. if chars[1] ~= nil then
  594. local teammate = false
  595. local p = Plrs:GetPlayerFromCharacter(chars[1][1])
  596. if p then
  597. if p.TeamColor == me.TeamColor then
  598. teammate = true
  599. end
  600. end
  601. chars[1][3].Health = chars[1][3].Health - SmashDmg
  602. end
  603. end
  604. function Smash()
  605. Smashing = true
  606. PlaySound("rbxasset://sounds//swordslash.wav", 0.8, 0.75)
  607. for i = 0, 1, 0.15 do
  608. TW.C0 = CFrame.Angles(0, math.rad(-45+45*i), 0)
  609. RAW.C0 = CFrame.Angles(math.rad(90+90*i), 0, math.rad(-45+45*i)) * CFrame.new(0, -0.7+0.7*i, -0.02)
  610. LAW.C0 = CFrame.Angles(math.rad(90-45*i), 0, math.rad(40)) * CFrame.new(0, -0.6+0.3*i, -0.01)
  611. wait()
  612. end
  613. for i = 0, 1, 0.33 do
  614. TW.C0 = CFrame.Angles(0, math.rad(25*i), 0) --45*i
  615. RAW.C0 = CFrame.Angles(math.rad(180-80*i), 0, math.rad(5*i)) * CFrame.new(0, -0.2*i, -0.02)
  616. LAW.C0 = CFrame.Angles(math.rad(45-45*i), 0, math.rad(40-25*i)) * CFrame.new(0, -0.6+0.3+0.15*i, -0.01)
  617. wait()
  618. end
  619. SmashGet()
  620. for i = 0.5, 1, 0.5 do
  621. TW.C0 = CFrame.Angles(0, math.rad(25+20*i), 0)
  622. RAW.C0 = CFrame.Angles(math.rad(180-80-60*i), 0, math.rad(5+5*i)) * CFrame.new(0, -0.2, -0.02)
  623. LAW.C0 = CFrame.Angles(math.rad(45-45-35*i), 0, math.rad(40-25-15*i)) * CFrame.new(0, -0.6+0.3+0.15+0.15*i, -0.01)
  624. wait()
  625. end
  626. for i = 0, 1, 0.1 do
  627. TW.C0 = CFrame.Angles(0, math.rad(45-90*i), 0)
  628. RAW.C0 = CFrame.Angles(math.rad(40+50*i), 0, math.rad(10-55*i)) * CFrame.new(0, -0.35-0.35*i, -0.02)
  629. LAW.C0 = CFrame.Angles(math.rad(-35+125*i), 0, math.rad(40*i)) * CFrame.new(0, -0.6*i, -0.01)
  630. wait()
  631. end
  632. RAW.C0 = RAWMain
  633. LAW.C0 = LAWMain
  634. TW.C0 = CFrame.Angles(0, math.rad(-45), 0)
  635. Smashing = false
  636. end
  637. bin.Equipped:connect(function(mouse)
  638. Selected = true
  639. bin.Parent = nil
  640. mouse.Button1Down:connect(function()
  641. if Able and hum.Health > 0 and Charge >= ChargeCost and Charging == false and Smashing == false then
  642. Charge = Charge - ChargeCost
  643. Able = false
  644. local from = Handle.CFrame * CFrame.new(0, 2, -0.2).p
  645. local to = mouse.Hit.p
  646. Fire(from, to, 420, true)
  647. wait(Debounce)
  648. Able = true
  649. elseif Charge < ChargeCost and Able and Smashing == false then
  650. Reload()
  651. end
  652. end)
  653. mouse.KeyDown:connect(function(key)
  654. key = key:lower()
  655. if Charging == false and Smashing == false and Able then
  656. if key == "f" then
  657. Throw(mouse.Hit.p)
  658. elseif key == "r" then
  659. Reload()
  660. elseif key == "q" then
  661. Smash()
  662. end
  663. end
  664. if key == "c" and Smashing == false then
  665. Crouch()
  666. end
  667. end)
  668. while hum.Health > 0 do
  669. if Throwing == false and Charging == false and ShootAnim == false and Able then
  670. local mousepos = mouse.Hit.p
  671. local mypos = torso.Position + Vector3.new(0, 0.5, 0)
  672. local magn = (mypos - mousepos).magnitude/75
  673. local offset = (mypos.y - mousepos.y)/65
  674. offset = offset/magn
  675. if offset > 0.75 then offset = 0.75 elseif offset < -1 then offset = -1 end
  676. local oh = 26
  677. local Main1, Main2 = RAWMain, LAWMain
  678. if Crouching and CrouchR then
  679. Main1, Main2 = CrouchR, CrouchL
  680. end
  681. RAW.C0 = Main1 * CFrame.Angles(-math.ceil(offset*22)/oh, 0, 0) * CFrame.new(0, -math.floor(math.abs(offset/4.5)*15)/35, 0)
  682. LAW.C0 = Main2 * CFrame.Angles(-math.ceil(offset*20)/oh, 0, math.floor(math.abs(offset/3.5)*6)/25) * CFrame.new(0, -math.floor(math.abs(offset/3.5)*25)/oh, 0)
  683. end
  684. if Charging then
  685. mouse.Icon = MouseRe
  686. else
  687. mouse.Icon = MouseIc
  688. end
  689. wait()
  690. end
  691. end)
  692. bin.Parent = char
  693. local bg = Add.BG(nil)
  694. while true do
  695. if Crouching then
  696. hum.WalkSpeed = 8
  697. bg.Parent = torso
  698. bg.cframe = ComputePos(cam.CoordinateFrame.p, torso.Position)
  699. else
  700. bg.Parent = nil
  701. hum.WalkSpeed = 16
  702. end
  703. if Charge > MaxCharge then Charge = MaxCharge end
  704. if Grenades > MaxGrenades then Grenades = MaxGrenades end
  705. GrenadeBar.Size = UDim2.new(1, -4, Grenades/MaxGrenades, 0)
  706. GrenadeBar.Position = UDim2.new(0, 2, 0, 0)
  707. ChargeBar.Size = UDim2.new(1, -4, -(Charge/MaxCharge), 0)
  708. ChargeBar.Position = UDim2.new(0, 2, 1, 0)
  709. CBT.Text = math.ceil((Charge/MaxCharge)*100).."%"
  710. GBT.Text = Grenades
  711. local magn = (head.Position - cam.CoordinateFrame.p).magnitude
  712. if magn > 2.4 then
  713. --Fillscreen.Visible = true
  714. else
  715. --Fillscreen.Visible = false
  716. end
  717. wait()
  718. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement