Advertisement
NextFlamePB

ROBLOX Kung FU Fightin Script

Sep 6th, 2015
4,559
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.75 KB | None | 0 0
  1. --==Made by NextFlame==--
  2.  
  3.  
  4. repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character
  5. local player=game.Players.LocalPlayer
  6. local char=player.Character
  7. local torso=char.Torso
  8. local head=char.Head
  9. local human=char.Humanoid
  10. local arm={Left=char["Left Arm"], Right=char["Right Arm"]}
  11. local leg={Left=char["Left Leg"], Right=char["Right Leg"]}
  12. local joints={LeftShoulder=torso["Left Shoulder"], RightShoulder=torso["Right Shoulder"], LeftHip=torso["Left Hip"], RightHip=torso["Right Hip"]}
  13. joints.LeftShoulder.Part0=torso
  14. joints.RightShoulder.Part0=torso
  15. joints.LeftHip.Part0=torso
  16. joints.RightHip.Part0=torso
  17. local c=function(f) Spawn(f) end
  18. local add={
  19. Part=function(par, a, c, col, t, s, cf, ms)
  20. local p=Instance.new("Part", par) pcall(function() p.TopSurface="Smooth" p.BottomSurface="Smooth" p.formFactor="Custom" p.Anchored=a p.CanCollide=c p.BrickColor=BrickColor.new(col) p.Transparency=t p.Size=s p.CFrame=cf or CFrame.new() end)
  21. local m=Instance.new("BlockMesh", p) pcall(function() m.Scale=ms or Vector3.new(1, 1, 1) end)
  22. return p
  23. end,
  24. Wedge=function(par, a, c, col, t, s, cf, ms)
  25. local p=Instance.new("WedgePart", par) pcall(function() p.TopSurface="Smooth" p.BottomSurface="Smooth" p.formFactor="Custom" p.Anchored=a p.CanCollide=c p.BrickColor=BrickColor.new(col) p.Transparency=t p.Size=s p.CFrame=cf or CFrame.new() end)
  26. local m=Instance.new("SpecialMesh", p) pcall(function() m.Scale=ms or Vector3.new(1, 1, 1) m.MeshType="Wedge" end)
  27. return p
  28. end,
  29. Gui=function(ins, par, bc, bg, tc, fs, text, t, s, pos)
  30. local g=Instance.new(ins, par) pcall(function() g.BorderColor=BrickColor.new(bc) g.BackgroundColor=BrickColor.new(bg) g.TextColor=BrickColor.new(tc) g.FontSize=fs g.Font="ArialBold" g.Text=text g.Transparency=t g.Size=s g.Position=pos end)
  31. return g
  32. end,
  33. Weld=function(par, p1, cf)
  34. local w=Instance.new("Weld", par) pcall(function() w.Part0=w.Parent or par w.Part1=p1 w.C1=cf or CFrame.new() end)
  35. return w
  36. end,
  37. Mesh=function(ins, par, s, of, t, id)
  38. local m=Instance.new(ins, par) pcall(function() m.Scale=s or Vector3.new() m.Offset=of or Vector3.new() m.MeshId=id or "" m.MeshType=t end)
  39. return m
  40. end,
  41. Sound=function(parent, id, volume, pitch)
  42. local s=Instance.new("Sound", parent) pcall(function() s.SoundId=id s.Volume=volume s.Pitch=pitch end)
  43. return s
  44. end,
  45. }
  46. local modelName="Kung Fu" --Name here
  47. pcall(function() player.Backpack[modelName]:remove() char[modelName]:remove() char["CharacterParts"]:remove() end)
  48. local model=Instance.new("Model", char) model.Name="CharacterParts"
  49. local modelB=Instance.new("Model", char) modelB.Name=modelName
  50. local bin=Instance.new("HopperBin", player.Backpack) bin.Name=modelName
  51. local skincolor="Really black"
  52. local gui=Instance.new("ScreenGui")
  53. local body={}
  54. local animate={}
  55. local obj={}
  56. --Variables--
  57. local trailDeb=false
  58. local keyDeb=false
  59. local hitDeb=false
  60. local loop=false
  61. local speed=16
  62. local combo=0
  63. local Slash=add.Sound(torso, "rbxasset://sounds//swordslash.wav", 1, 1.2)
  64. local Hit=add.Sound(torso, "http://roblox.com/asset/?id=10209225", 1, 1)
  65. function createParts()
  66. --==PARTS==--
  67. torso.Transparency=1
  68. for i, v in pairs(char:children()) do if v:isA("CharacterMesh") then v:remove() end end
  69. gui.Parent=player.PlayerGui gui.Name=modelName
  70. body.Head=add.Part(model, false, false, skincolor, 1, Vector3.new(1, 1, 1), nil)
  71. body.Torso=add.Part(model, false, false, skincolor, 0, Vector3.new(2, 2, 1), nil)
  72. body.ArmLeft, body.ArmRight=add.Part(model, false, false, skincolor, 1, Vector3.new(1, 1, 1), nil), add.Part(model, false, false, skincolor, 1, Vector3.new(1, 1, 1), nil)
  73. body.LegLeft, body.LegRight=add.Part(model, false, false, skincolor, 1, Vector3.new(1, 1, 1), nil), add.Part(model, false, false, skincolor, 1, Vector3.new(1, 1, 1), nil)
  74. --==WELDS==--
  75. body.HeadW=add.Weld(body.Head, body.Torso, CFrame.new(0, 1.5, 0))
  76. body.TorsoW=add.Weld(body.Torso, torso, nil)
  77. body.ArmLeftW, body.ArmRightW=add.Weld(body.ArmLeft, body.Torso, CFrame.new(-1.5, .5, 0)), add.Weld(body.ArmRight, body.Torso, CFrame.new(1.5, .5, 0))
  78. body.LegLeftW, body.LegRightW=add.Weld(body.LegLeft, body.Torso, CFrame.new(-.5, -1, 0)), add.Weld(body.LegRight, body.Torso, CFrame.new(.5, -1, 0))
  79. --==WELDS2==--
  80. add.Weld(body.Head, head, nil)
  81. add.Weld(arm.Left, body.ArmLeft, CFrame.new(0, -.5, 0))
  82. add.Weld(arm.Right, body.ArmRight, CFrame.new(0, -.5, 0))
  83. joints.LeftHip.Part0=body.Torso
  84. joints.RightHip.Part0=body.Torso
  85. --==Sign==--
  86. body.Part=add.Part(model, false, false, "White", 0, Vector3.new(.2, 1, .2))
  87. add.Weld(body.Part, body.Torso, CFrame.new(-.25, 0, .5))
  88. body.Part=add.Part(model, false, false, "White", 0, Vector3.new(.7, .2, .2))
  89. add.Weld(body.Part, body.Torso, CFrame.new(0, -.5, .5))
  90. body.Part=add.Part(model, false, false, "White", 0, Vector3.new(.2, 1, .2))
  91. add.Weld(body.Part, body.Torso, CFrame.new(.25, 0, -.5))
  92. body.Part=add.Part(model, false, false, "White", 0, Vector3.new(.7, .2, .2))
  93. add.Weld(body.Part, body.Torso, CFrame.new(0, -.5, -.5))
  94. ---------------------------------------------------------------------------------------
  95. animate={
  96. ["Head"]=function(cf)
  97. body.HeadW.C1=CFrame.new(0, 1.5, 0)*cf
  98. end;
  99. ["Torso"]=function(cf)
  100. body.TorsoW.C1=(cf or CFrame.new()*CFrame.Angles(0, 0, 0))
  101. end;
  102. ["ArmLeft"]=function(cf)
  103. body.ArmLeftW.C1=CFrame.new(-1.5, .5, 0)*(cf or CFrame.new()*CFrame.Angles(0, 0, 0))
  104. end;
  105. ["ArmRight"]=function(cf)
  106. body.ArmRightW.C1=CFrame.new(1.5, .5, 0)*(cf or CFrame.new()*CFrame.Angles(0, 0, 0))
  107. end;
  108. ["LegLeft"]=function(cf)
  109. legLeftW=add.Weld(leg.Left, body.LegLeft, CFrame.new(0, -1, 0))
  110. body.LegLeftW.C1=CFrame.new(-.5, -1, 0)*(cf or CFrame.new()*CFrame.Angles(0, 0, 0))
  111. coroutine.resume(coroutine.create(function()
  112. wait()
  113. legLeftW:remove()
  114. end))
  115. end;
  116. ["LegRight"]=function(cf)
  117. legRightW=add.Weld(leg.Right, body.LegRight, CFrame.new(0, -1, 0))
  118. body.LegRightW.C1=CFrame.new(.5, -1, 0)*(cf or CFrame.new()*CFrame.Angles(0, 0, 0))
  119. coroutine.resume(coroutine.create(function()
  120. wait()
  121. legRightW:remove()
  122. end))
  123. end;
  124. }
  125. --==Objects==--
  126. obj.attackLabel=add.Gui("TextLabel", gui, "Really black", "Really black", "White", "Size18", "(5) Combos", 0, UDim2.new(0, 150, 0, 50), UDim2.new(0, 0, 0, 150))
  127. obj.attackLabel2=add.Gui("TextLabel", obj.attackLabel, "Really black", "Really black", "White", "Size18", "Punch[Right]", 0, UDim2.new(1, 0, 1, 0), UDim2.new(0, 0, 1, 0))
  128. obj.attackLabel3=add.Gui("TextLabel", obj.attackLabel2, "Really black", "Really black", "White", "Size18", "Punch[Left]", 0, UDim2.new(1, 0, 1, 0), UDim2.new(0, 0, 1, 0))
  129. obj.attackLabel4=add.Gui("TextLabel", obj.attackLabel3, "Really black", "Really black", "White", "Size18", "Kick[Right]", 0, UDim2.new(1, 0, 1, 0), UDim2.new(0, 0, 1, 0))
  130. obj.attackLabel5=add.Gui("TextLabel", obj.attackLabel4, "Really black", "Really black", "White", "Size18", "Kick[Left]", 0, UDim2.new(1, 0, 1, 0), UDim2.new(0, 0, 1, 0))
  131. obj.attackLabel6=add.Gui("TextLabel", obj.attackLabel5, "Really black", "Really black", "White", "Size18", "RappidKick", 0, UDim2.new(1, 0, 1, 0), UDim2.new(0, 0, 1, 0))
  132. for i, v in pairs(modelB:children()) do
  133. if i==0 then return end
  134. end
  135. --==Weapon==--
  136. end
  137. function removeParts()
  138. pcall(function()
  139. if torso then
  140. joints.LeftShoulder.Part0=torso
  141. joints.RightShoulder.Part0=torso
  142. joints.LeftHip.Part0=torso
  143. joints.RightHip.Part0=torso
  144. torso.Transparency=0
  145. end
  146. player.PlayerGui[modelName]:remove()
  147. for i, v in pairs(model:children()) do v:remove() end
  148. end)
  149. end
  150. function lightningGen(startPos, endPos)
  151. local magnitude=(startPos-endPos).magnitude
  152. local distance=(startPos+endPos)/2
  153. local pattern=add.Part(workspace, true, false, "White", 1, Vector3.new(.2, .2, magnitude), CFrame.new(distance, startPos))
  154. local startPosProx=startPos
  155. for i=1, 9 do
  156. local startPosProx2=startPosProx
  157. local random=Vector3.new(math.random(-1, 1), math.random(-1, 1), math.random(-1, 1))
  158. local findSize=pattern.Size.z/10
  159. local findOffSet=pattern.CFrame.lookVector*-1
  160. local compute=i*findSize*findOffSet
  161. local newStartPos=startPos
  162. local newEndPos=CFrame.new(random+compute+newStartPos).p
  163. local magnitude=(startPosProx2-newEndPos).magnitude
  164. local distance=(startPosProx2+newEndPos)/2
  165. local lightning=add.Part(workspace, true, false, "Bright yellow", 0, Vector3.new(.2, .2, magnitude), CFrame.new(distance, startPosProx2))
  166. c(function()
  167. for i=0, 1, .1 do wait()
  168. lightning.Transparency=i
  169. end
  170. lightning:remove()
  171. end)
  172. startPosProx=newEndPos
  173. end
  174. pattern:remove()
  175. end
  176. function computePos(pos, pos2)
  177. local pos3=Vector3.new(pos2.x, pos.y, pos2.z)
  178. return CFrame.new(pos, pos3)
  179. end
  180. function nearTorso(pos, dis)
  181. local temp
  182. local distance=dis
  183. for i, v in pairs(workspace:children()) do
  184. if v:isA("Model") then
  185. temp=v:findFirstChild("Torso")
  186. local humanoid=v:findFirstChild("Humanoid")
  187. if temp and humanoid and v~=char and (temp.CFrame.p-pos).magnitude<distance then
  188. distance=(temp.CFrame.p-pos).magnitude
  189. return temp
  190. end
  191. end
  192. end
  193. end
  194. function trail(pos, cf, col, size)
  195. c(function()
  196. local old=(pos.CFrame*cf).p
  197. while trailDeb==true do
  198. wait()
  199. local new=(pos.CFrame*cf).p
  200. local mag=(old-new).magnitude
  201. local dis=(old+new)/2
  202. local trail=add.Part(workspace, true, false, col or "White", 0, Vector3.new(size or .2, mag, size or .2), CFrame.new(dis, new)*CFrame.Angles(math.pi/2, 0, 0)) trail.Name="Effect"
  203. local tMesh=add.Mesh("CylinderMesh", trail, Vector3.new(1, 1, 1), nil, nil)
  204. old=new
  205. c(function()
  206. for i=1, 0, -.1 do
  207. wait()
  208. tMesh.Scale=tMesh.Scale*Vector3.new(i, 1, i)
  209. end
  210. trail:remove()
  211. end)
  212. c(function()
  213. for i=0, 1, .1 do
  214. wait()
  215. trail.Transparency=i
  216. end
  217. end)
  218. end
  219. end)
  220. end
  221. function rayCast(pos, dir, col)
  222. local magnitude=(pos-dir).magnitude
  223. local distance=(pos+dir)/2
  224. local ray=add.Part(workspace, true, false, col, 0, Vector3.new(.2, magnitude, .2), CFrame.new(distance, pos))
  225. return ray
  226. end
  227. function dmgHit(h)
  228. local dmg=math.random(5, 10)
  229. if keyDeb==true and h.Parent:findFirstChild("Humanoid") and hitDeb==false and h.Parent~=char then
  230. hitDeb=true
  231. local hHuman=h.Parent:findFirstChild("Humanoid")
  232. local hTorso=h.Parent:findFirstChild("Torso")
  233. hHuman.Health=hHuman.Health-dmg
  234. local fakeM=Instance.new("Model", workspace) fakeM.Name=-dmg
  235. local fakeH=Instance.new("Humanoid", fakeM) fakeH.MaxHealth=0 fakeH.Health=0
  236. local effect=add.Part(fakeM, true, false, "Bright red", 0, Vector3.new(1, 1, 1), hTorso.CFrame*CFrame.new(0, 4, 0)) effect.Name="Head"
  237. local fakeMesh=add.Mesh("CylinderMesh", effect, Vector3.new(1, .5, 1), nil, nil)
  238. local effect=add.Part(workspace, true, false, "White", .5, Vector3.new(1, 1, 1), CFrame.new(h.CFrame.p, torso.CFrame.p)*CFrame.Angles(-math.pi/2, 0, 0))
  239. local effectM=add.Mesh("SpecialMesh", effect, Vector3.new(1, 1, 1), nil, nil, "http://www.roblox.com/asset/?id=20329976")
  240. c(function()
  241. for i=1, 2, .1 do wait()
  242. effectM.Scale=Vector3.new(i, i/2, i)
  243. end
  244. effect:remove()
  245. end)
  246. game.Debris:addItem(fakeM, 1)
  247. wait(.1)
  248. hitDeb=false
  249. end
  250. end
  251. function idled()
  252. animate.ArmLeft(CFrame.new(.5, 0, 0)*CFrame.Angles(math.rad(135), 0, math.rad(5)))
  253. animate.ArmRight(CFrame.new(-.5, 0, 0)*CFrame.Angles(math.rad(135), 0, -math.rad(5)))
  254. end
  255. function doAttacks()
  256. combo=combo+1
  257. if keyDeb==false then
  258. keyDeb=true
  259. if combo>0 then Slash:play()
  260. trailDeb=true
  261. trail(body.ArmRight, CFrame.new(0, -2.5, 0))
  262. for i=0, 1, .2 do wait()
  263. animate.Torso(CFrame.Angles(0, math.rad(90)*i, 0))
  264. animate.ArmRight(CFrame.Angles(math.rad(90), 0, math.rad(90)*i))
  265. end
  266. trailDeb=false
  267. for i=1, 0, -.2 do wait()
  268. animate.Torso(CFrame.Angles(0, math.rad(90)*i, 0))
  269. animate.ArmRight(CFrame.Angles(math.rad(90), 0, math.rad(90)*i))
  270. end
  271. end
  272. if combo>2 then Slash:play()
  273. trailDeb=true
  274. trail(body.ArmLeft, CFrame.new(0, -2.5, 0))
  275. for i=0, 1, .2 do wait()
  276. animate.Torso(CFrame.Angles(0, -math.rad(90)*i, 0))
  277. animate.ArmLeft(CFrame.Angles(math.rad(90), 0, -math.rad(90)*i))
  278. end
  279. trailDeb=false
  280. for i=1, 0, -.2 do wait()
  281. animate.Torso(CFrame.Angles(0, -math.rad(90)*i, 0))
  282. animate.ArmLeft(CFrame.Angles(math.rad(90), 0, -math.rad(90)*i))
  283. end
  284. end
  285. if combo>3 then Slash:play()
  286. idled()
  287. trailDeb=true
  288. trail(body.LegRight, CFrame.new(0, -2.5, 0))
  289. for i=0, 1, .2 do wait()
  290. animate.Torso(CFrame.new(0, -1*i, 0)*CFrame.Angles(math.rad(135)*i, math.rad(90)*i, 0))
  291. animate.LegLeft(CFrame.new(-.5*i, 0, 0)*CFrame.Angles(0, 0, -math.rad(135)*i))
  292. end
  293. trailDeb=false
  294. for i=1, 0, -.2 do wait()
  295. animate.Torso(CFrame.new(0, -1*i, 0)*CFrame.Angles(math.rad(135)*i, math.rad(90)*i, 0))
  296. animate.LegLeft(CFrame.new(-.5*i, 0, 0)*CFrame.Angles(0, 0, -math.rad(135)*i))
  297. end
  298. end
  299. if combo>4 then Slash:play()
  300. idled()
  301. trailDeb=true
  302. trail(body.LegLeft, CFrame.new(0, -2.5, 0))
  303. for i=0, 1, .2 do wait()
  304. animate.Torso(CFrame.new(0, -1*i, 0)*CFrame.Angles(math.rad(135)*i, -math.rad(90)*i, 0))
  305. animate.LegRight(CFrame.new(.5*i, 0, 0)*CFrame.Angles(0, 0, math.rad(135)*i))
  306. end
  307. trailDeb=false
  308. for i=1, 0, -.2 do wait()
  309. animate.Torso(CFrame.new(0, -1*i, 0)*CFrame.Angles(math.rad(135)*i, -math.rad(90)*i, 0))
  310. animate.LegRight(CFrame.new(.5*i, 0, 0)*CFrame.Angles(0, 0, math.rad(135)*i))
  311. end
  312. end
  313. if combo>5 then
  314. idled()
  315. for i=0, 1, .2 do wait()
  316. animate.Torso(CFrame.new(0, -.8*i, 0)*CFrame.Angles(math.rad(80)*i, -math.rad(90)*i, 0))
  317. end
  318. for i=1, 20 do wait() Slash:play()
  319. torso.CFrame=torso.CFrame+torso.CFrame.lookVector*.2
  320. animate.LegLeft(CFrame.Angles(math.rad(math.random(-45, 45)), math.rad(math.random(-45, 45)), math.rad(math.random(-45, 45))))
  321. animate.LegRight(CFrame.Angles(math.rad(math.random(-45, 45)), math.rad(math.random(-45, 45)), math.rad(math.random(-45, 45))))
  322. end
  323. for i=1, 0, -.2 do wait()
  324. animate.Torso(CFrame.new(0, -.8*i, 0)*CFrame.Angles(math.rad(80)*i, -math.rad(90)*i, 0))
  325. end
  326. end
  327. trailDeb=false
  328. keyDeb=false
  329. combo=0
  330. idled()
  331. end
  332. end
  333. bin.Selected:connect(function(mouse) createParts()
  334. for i, v in pairs(char:children()) do if v:isA("BasePart") then v.Touched:connect(dmgHit) end end
  335. for i=0, 1, .1 do wait()
  336. animate.ArmLeft(CFrame.new(.5*i, 0, 0)*CFrame.Angles(math.rad(135)*i, 0, math.rad(5)*i))
  337. animate.ArmRight(CFrame.new(-.5*i, 0, 0)*CFrame.Angles(math.rad(135)*i, 0, -math.rad(5)*i))
  338. end
  339. mouse.Button1Down:connect(doAttacks)
  340. end)
  341. bin.Deselected:connect(function()
  342. for i=1, 0, -.1 do wait()
  343. animate.ArmLeft(CFrame.new(.5*i, 0, 0)*CFrame.Angles(math.rad(135)*i, 0, math.rad(5)*i))
  344. animate.ArmRight(CFrame.new(-.5*i, 0, 0)*CFrame.Angles(math.rad(135)*i, 0, -math.rad(5)*i))
  345. end
  346. removeParts()
  347. end)--mediafire
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement