Advertisement
wulfbawg

[ROBLOX] - Wulfbug9's Sword

Jul 20th, 2014
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.69 KB | None | 0 0
  1. -- > Made by wulfbug9.
  2. -- > Unfinished, never going to work on it again.
  3. -- > Enjoy.
  4.  
  5. ------------------------------------------------------------------------ useful functions
  6. function r(n) return (math.random()-.5)*2*n end
  7. function c(func,args) coroutine.resume(coroutine.create(func),unpack(args or {})) end
  8. function Part(Name,Parent,Size,CFrame,Color,Trans,Anch,Can,Mat)
  9.     local surfaces = {"Front","Back","Left","Right","Top","Bottom"}
  10.     local p = Instance.new("Part",Parent)p.Name = Name
  11.     p.FormFactor = "Custom"p.Size = Size
  12.     p.Anchored = Anch p.CFrame = CFrame
  13.     p.BrickColor = BrickColor.new(Color)p.Transparency = Trans
  14.     p.CanCollide = Can;p.Material = Mat
  15.     p:BreakJoints();p.Locked = true
  16.     for i=1,#surfaces do p[surfaces[i].."Surface"] = 10 end
  17.     return p
  18. end
  19. function WedgePart(Name,Parent,Size,CFrame,Color,Trans,Anch,Can,Mat)
  20.     local surfaces = {"Front","Back","Left","Right","Top","Bottom"}
  21.     local p = Instance.new("WedgePart",Parent)p.Name = Name
  22.     p.FormFactor = "Custom"p.Size = Size
  23.     p.Anchored = Anch p.CFrame = CFrame
  24.     p.BrickColor = BrickColor.new(Color)p.Transparency = Trans
  25.     p.CanCollide = Can;p.Material = Mat
  26.     p:BreakJoints();p.Locked = true
  27.     for i=1,#surfaces do p[surfaces[i].."Surface"] = 10 end
  28.     return p
  29. end
  30. function Mesh(Parent,Type,Scale,ID,TID)
  31.     local m = Instance.new("SpecialMesh",Parent)m.MeshType = Type
  32.     m.Scale = Scale or Vector3.new(1,1,1)
  33.     if ID then m.MeshId = ID end if TID then m.TextureId = TID end
  34.     return m
  35. end
  36. function Weld(p1,p2,c0,c1)
  37.     local w = Instance.new("Weld",p1)w.Part0 = p1;w.Part1 = p2
  38.     w.C0,w.C1 = c0 or CFrame.new(),c1 or CFrame.new()
  39.     return w
  40. end
  41. function rayCast(pos,dir,ign)
  42.     ign = ign or {char}
  43.     return workspace:FindPartOnRayWithIgnoreList(Ray.new(pos,dir),ign)
  44. end
  45. ------------------------------------------------------------------------
  46. Tween = {}
  47. function slerp(a,b,c)return (1-c)*a+(c*b)end
  48. function cslerp(start,destination,increment)
  49.     local c1 = {start.X,start.Y,start.Z,start:toEulerAnglesXYZ()}
  50.     local c2 = {destination.X,destination.Y,destination.Z,destination:toEulerAnglesXYZ()}
  51.     for i,v in pairs(c1)do c1[i] = slerp(v,c2[i],increment)end
  52.     return CFrame.new(c1[1],c1[2],c1[3])*CFrame.Angles(c1[4],c1[5],c1[6])
  53. end
  54. function TweenWeld(weld,type,start,finish,speed,sync)
  55.     if Tween[weld] and Tween[weld][1] == true then return end
  56.     Tween[weld] = {weld,true}
  57.     local function T()
  58.         for i=1,speed do
  59.             local s = i/speed
  60.             weld[type] = cslerp(start,finish,s)
  61.             game:service("RunService").Stepped:wait()
  62.         end
  63.         Tween[weld] = {weld,false}
  64.     end
  65.     if sync then coroutine.wrap(T)() else T() end
  66. end
  67. ------------------------------------------------------------------------ variables
  68. player = game:service("Players").LocalPlayer
  69. local char
  70. repeat wait() char = player.Character until char
  71. root = char:WaitForChild("HumanoidRootPart")
  72. torso = char:WaitForChild("Torso")
  73. humanoid = char:WaitForChild("Humanoid")
  74. head = char:WaitForChild("Head")
  75. bodycolours = char:WaitForChild("Body Colors")
  76. mouse = player:GetMouse()
  77. step = game:service("RunService").RenderStepped
  78. camera = workspace.CurrentCamera
  79. asset = "http://www.roblox.com/asset/?id="
  80. meshes = {["blast"] = 20329976,["ring"] = 3270017,["spike"] = 1033714,["cone"] = 1082802,["crown"] = 20329976,["cloud"] = 1095708,["diamond"] = 9756362}
  81. sounds = {["explode"] = 130792180;["spin"] = 147722227;["patrick"] = 135290668;["hit"] = 146163493}
  82. torsomesh = "rbxasset://fonts/torso.mesh"
  83. Attacking = false
  84. Trailing = true
  85. target = nil
  86. tweenLegs = false
  87. Events = setmetatable({},{ -- kinda useless in this script but eh
  88.     __nexindex = function(self,Index,Value)
  89.         local T = {}
  90.         T.Name = Index
  91.         T.Event = Value
  92.         table.insert(self,T)
  93.     end;
  94.     __call = function(self,Index)
  95.         for i,v in pairs(self) do
  96.             if v.Name == Index then
  97.                 return true,v.Event
  98.             end
  99.         end
  100.         return false,nil
  101.     end;
  102. })
  103. c0 = {
  104.     ls = CFrame.new(-1,0.5,0)*CFrame.new(.5,0,0)*CFrame.Angles(math.pi/3,0,math.pi/4),
  105.     rs = CFrame.new(1,0.5,0)*CFrame.new(-.3,0,0)*CFrame.Angles(math.pi/3,0,-math.pi/10),
  106.     lh = CFrame.new(-1,-1,0),
  107.     rh = CFrame.new(1,-1,0),
  108.     nk = CFrame.new(0,1,0)*CFrame.Angles(0,math.pi/9,0),
  109.     tw = CFrame.new(0,0,0)*CFrame.Angles(0,-math.pi/9,0),
  110. }
  111. c0NA = {
  112.     ls = CFrame.new(-1,0.5,0),
  113.     rs = CFrame.new(1,0.5,0),
  114.     lh = CFrame.new(-1,-1,0),
  115.     rh = CFrame.new(1,-1,0),
  116.     nk = CFrame.new(0,1,0),
  117.     tw = CFrame.new(0,0,0),
  118. }
  119. c1 = {
  120.     ls = CFrame.new(0.5,0.5,0),
  121.     rs = CFrame.new(-0.5,0.5,0),
  122.     lh = CFrame.new(-.5,1,0),
  123.     rh = CFrame.new(.5,1,0),
  124.     nk = CFrame.new(0,-.5,0),
  125.     tw = CFrame.new(0,0,0),
  126. }
  127. slashset = {
  128.     last = tick();
  129.     clicked = false;
  130. }
  131. combo1set = {
  132.     last = tick();
  133.     clicked = false;
  134. }
  135. Spin,Rad = false,0
  136. Mode = "Slash"
  137. bg = Instance.new("BodyGyro",root)
  138. bg.maxTorque = Vector3.new(1,1,1)*10^6
  139. bg.P = 10^4
  140. rs = Weld(torso,char:WaitForChild("Right Arm"),c0.rs,c1.rs)
  141. ls = Weld(torso,char:WaitForChild("Left Arm"),c0.ls,c1.ls)
  142. rh = Weld(torso,char:WaitForChild("Right Leg"),c0.rh,c1.rh)
  143. lh = Weld(torso,char:WaitForChild("Left Leg"),c0.lh,c1.lh)
  144. tw = Weld(root,torso,c0.tw)
  145. hw = Weld(torso,head,c0.nk,c1.nk)
  146. colour = {"Black","Tr. Yellow","Bright yellow"}
  147. --{"Black","Medium red","Bright red"}
  148. --{"Black","Pastel blue-green","Teal"}
  149. --{"Black","Tr. Red","Red flip/flop"}
  150. --{"Black","Tr. Yellow","Bright yellow"}
  151. --{"Black","Med. yellowish orange","Bright orange"}
  152. local model,ohw
  153. ------------------------------------------------------------------------ effects & functions
  154. function quickSound(id,v,p)
  155.     local s = Instance.new("Sound",workspace)
  156.     s.SoundId = id
  157.     s.PlayOnRemove = true
  158.     s.Volume = v or 1
  159.     s.Pitch = p or 1
  160.     delay(0.025,function()s:remove()end)
  161. end
  162. function checkDmgArea(origin,dmg,d)
  163.     for i,v in pairs(workspace:children())do
  164.         if v~=char and v:FindFirstChild("Torso") then
  165.             local h;
  166.             for _,k in pairs(v:children())do if k:IsA("Humanoid") then h = k end end
  167.             local dist = (origin.p - v:FindFirstChild("Torso").CFrame.p).magnitude
  168.             if dist < d and h~=nil then
  169.                 h.Health = h.Health - dmg
  170.             end
  171.         end
  172.     end
  173. end
  174. function findClosestPlayer(origin,d)
  175.     local bdist,plr = d,nil
  176.     for i,v in pairs(workspace:children())do
  177.         if v~=char and v:FindFirstChild("Torso") then
  178.             local h;
  179.             for _,k in pairs(v:children())do if k:IsA("Humanoid") then h = k end end
  180.             local dist = (origin.p - v:FindFirstChild("Torso").CFrame.p).magnitude
  181.             if dist < bdist and h~=nil and h.Health~=0 then
  182.                 bdist,plr = dist,v
  183.             end
  184.         end
  185.     end
  186.     return plr,bdist
  187. end
  188. function drawLine(mag,one,two)
  189.     local t = Part("",char,Vector3.new(.5,mag,.5),CFrame.new(one,two)*CFrame.new(0,0,-mag/2)*CFrame.Angles(math.pi/2,0,0),"White",0,true,false,"Plastic")
  190.     c(function(p,m)
  191.         for i=1,0,-.05 do
  192.             m.Scale = Vector3.new(i,1,i)
  193.             wait(1/30)
  194.         end
  195.         p:Destroy()
  196.     end,{t,Instance.new("CylinderMesh",t)})
  197. end
  198. function Trail(part)
  199.     Trailing = true
  200.     local lastPos = part.CFrame.p
  201.     local tik = tick()
  202.     local tim = .025
  203.     local loop;
  204.     loop = game:service("RunService").RenderStepped:connect(function()
  205.         if (tick()-tik)>tim and Trailing then
  206.             local dist = (lastPos-part.CFrame.p).magnitude
  207.             drawLine(dist,lastPos,part.CFrame.p)
  208.             lastPos = part.CFrame.p
  209.             tik = tick()
  210.         elseif not Trailing then
  211.             loop:disconnect()
  212.         end
  213.     end)
  214. end
  215. ------------------------------------------------------------------------ build the weapon
  216. pcall(function()char:FindFirstChild("Weapon"):Destroy()end)
  217. model = Instance.new("Model",char)
  218. model.Name = "Weapon"
  219. handle = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[1],0,false,false,"Plastic")
  220. handlem = Instance.new("CylinderMesh",handle)
  221. handlem.Scale = Vector3.new(.8,1,.8)
  222. handlew = Weld(char:FindFirstChild("Right Arm"),handle,CFrame.new(-.4,-1.1,0)*CFrame.Angles(-math.pi/2,math.pi/2,0))
  223. p1 = Part("",model,Vector3.new(0.25,0.25,0.25),torso.CFrame,colour[2],0,false,false,"Plastic")
  224. p1m = Instance.new("CylinderMesh",p1)
  225. p1w = Weld(handle,p1,CFrame.new(0,-.5,0))
  226. p2 = Part("",model,Vector3.new(0.3,0,0.3),torso.CFrame,colour[3],0,false,false,"Plastic")
  227. p2m = Instance.new("CylinderMesh",p2)
  228. p2w = Weld(p1,p2,CFrame.new(0,-.125,0))
  229. p3 = Part("",model,Vector3.new(0.25,0.25,0.25),torso.CFrame,colour[2],0,false,false,"Plastic")
  230. p3m = Instance.new("CylinderMesh",p3)
  231. p3w = Weld(handle,p3,CFrame.new(0,.5,0))
  232. p4 = Part("",model,Vector3.new(0.3,0,0.3),torso.CFrame,colour[3],0,false,false,"Plastic")
  233. p4m = Instance.new("CylinderMesh",p4)
  234. p4w = Weld(p3,p4,CFrame.new(0,.125,0))
  235. div = Part("",model,Vector3.new(2,0,.3),torso.CFrame,colour[1],0,false,false,"Plastic")
  236. divw = Weld(handle,div,CFrame.new(0,.75,0))
  237. p5 = Part("",model,Vector3.new(0,0,0),torso.CFrame,colour[1],0,false,false,"Plastic")
  238. p5m = Mesh(p5,"FileMesh",Vector3.new(.15,1,.15),asset..meshes["spike"])
  239. p5w = Weld(div,p5,CFrame.new(-1,.3,0)*CFrame.Angles(0,0,math.pi/6))
  240. p6 = Part("",model,Vector3.new(0,0,0),torso.CFrame,colour[1],0,false,false,"Plastic")
  241. p6m = Mesh(p6,"FileMesh",Vector3.new(.15,1,.15),asset..meshes["spike"])
  242. p6w = Weld(div,p6,CFrame.new(1,.3,0)*CFrame.Angles(0,0,-math.pi/6))
  243. blade = Part("",model,Vector3.new(1.5,4,0),torso.CFrame,colour[2],0.5,false,false,"SmoothPlastic")
  244. bladem = Mesh(blade,"Brick",Vector3.new(1.025,1,1))
  245. bladew = Weld(div,blade,CFrame.new(0,2,0))
  246. for i=1,9 do
  247.     local angle = math.pi*2/9*i
  248.     local p = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
  249.     local pm = Mesh(p,"FileMesh",Vector3.new(.075,.1475,.125),torsomesh)
  250.     local pw = Weld(blade,p,CFrame.Angles(0,math.pi/2,0)*CFrame.new(0,0,0)*CFrame.Angles(angle,0,0)*CFrame.new(0,0,.325))
  251. end
  252. for i=1,6 do
  253.     local angle = math.pi*2/6*i
  254.     local p = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
  255.     local pm = Mesh(p,"FileMesh",Vector3.new(.075,.1475,.125),torsomesh)
  256.     local pw = Weld(blade,p,CFrame.Angles(0,math.pi/2,0)*CFrame.new(0,1,-.5)*CFrame.Angles(angle,0,0)*CFrame.new(0,0,.19))
  257.     local p2 = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
  258.     local p2m = Mesh(p2,"FileMesh",Vector3.new(.075,.1475,.125),torsomesh)
  259.     local p2w = Weld(blade,p2,CFrame.Angles(0,math.pi/2,0)*CFrame.new(0,1,.5)*CFrame.Angles(angle,0,0)*CFrame.new(0,0,.19))
  260.     local p3 = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
  261.     local p3m = Mesh(p3,"FileMesh",Vector3.new(.075,.1475,.125),torsomesh)
  262.     local p3w = Weld(blade,p3,CFrame.Angles(0,math.pi/2,0)*CFrame.new(0,-1,0)*CFrame.Angles(angle,0,0)*CFrame.new(0,0,.19))
  263. end
  264. local tip
  265. local y = 2.15
  266. for i=1.5,0,-.5 do
  267.     local p = Part("",model,Vector3.new(0,0,i),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
  268.     local pm = Mesh(p,"Brick")
  269.     local pw = Weld(blade,p,CFrame.Angles(0,math.pi/2,0)*CFrame.new(0,y,0))
  270.     y = y + .25
  271.     if i==0 then tip = p end
  272. end
  273. bp = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
  274. bpm = Mesh(bp,"FileMesh",Vector3.new(.075,.215,.125),torsomesh)
  275. bpw = Weld(blade,bp,CFrame.Angles(0,math.pi/2,0)*CFrame.new(0,-.4,-.25)*CFrame.Angles(math.pi/6,0,0))
  276. bp2 = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
  277. bp2m = Mesh(bp2,"FileMesh",Vector3.new(.075,.215,.125),torsomesh)
  278. bp2w = Weld(blade,bp2,CFrame.Angles(0,math.pi/2,0)*CFrame.new(0,-.7,-.25)*CFrame.Angles(-math.pi/6,0,0))
  279. bp3 = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
  280. bp3m = Mesh(bp3,"FileMesh",Vector3.new(.075,.215,.125),torsomesh)
  281. bp3w = Weld(blade,bp3,CFrame.Angles(0,math.pi/2,0)*CFrame.new(0,-.4,.25)*CFrame.Angles(-math.pi/6,0,0))
  282. bp4 = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
  283. bp4m = Mesh(bp4,"FileMesh",Vector3.new(.075,.215,.125),torsomesh)
  284. bp4w = Weld(blade,bp4,CFrame.Angles(0,math.pi/2,0)*CFrame.new(0,-.7,.25)*CFrame.Angles(math.pi/6,0,0))
  285. bp5 = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
  286. bp5m = Mesh(bp5,"FileMesh",Vector3.new(.075,1.4,.125),torsomesh)
  287. bp5w = Weld(blade,bp5,CFrame.Angles(0,math.pi/2,0)*CFrame.new(0,-.55,.5))
  288. bp6 = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
  289. bp6m = Mesh(bp6,"FileMesh",Vector3.new(.075,1.4,.125),torsomesh)
  290. bp6w = Weld(blade,bp6,CFrame.Angles(0,math.pi/2,0)*CFrame.new(0,-.55,-.5))
  291. ohw,ohwNA = handlew.C0,CFrame.new(-.4,-1.1,0)
  292. ------------------------------------------------------------------------ attacks
  293. function returnToOriginal(speed,legbool)
  294.     TweenWeld(rs,"C0",rs.C0,c0.rs,speed,true)
  295.     TweenWeld(ls,"C0",ls.C0,c0.ls,speed,true)
  296.     if legbool then
  297.         TweenWeld(rh,"C0",rh.C0,c0.rh,speed,true)
  298.         TweenWeld(lh,"C0",lh.C0,c0.lh,speed,true)
  299.     end
  300.     TweenWeld(tw,"C0",tw.C0,c0.tw,speed,true)
  301.     TweenWeld(hw,"C0",hw.C0,c0.nk,speed,true)
  302.     TweenWeld(handlew,"C0",handlew.C0,ohw,speed)
  303. end
  304. function Slash()
  305.     Trail(tip)
  306.     c(function()
  307.         while wait()and Attacking do
  308.             checkDmgArea(blade.CFrame,5,4)
  309.         end
  310.     end)
  311.     TweenWeld(rs,"C0",rs.C0,c0NA.rs*CFrame.new(.25,0,-.5)*CFrame.Angles(math.pi/1.75,0,math.pi/2),5,true)
  312.     TweenWeld(ls,"C0",ls.C0,c0NA.ls*CFrame.new(0,0,-.5)*CFrame.Angles(math.pi/3,0,-math.pi/4),5,true)
  313.     TweenWeld(tw,"C0",tw.C0,c0NA.tw*CFrame.Angles(0,math.pi/2,0),5,true)
  314.     TweenWeld(hw,"C0",hw.C0,c0NA.nk*CFrame.Angles(0,-math.pi/2,0),5,true)
  315.     TweenWeld(handlew,"C0",handlew.C0,ohwNA*CFrame.Angles(0,0,math.pi),5)
  316.     Trailing = false
  317. end
  318. function PrepareSlash()
  319.     Attacking = true
  320.     slashset.clicked = false
  321.     TweenWeld(rs,"C0",rs.C0,c0NA.rs*CFrame.new(0,0,-.5)*CFrame.Angles(math.pi/1.75,0,math.pi/4),5,true)
  322.     TweenWeld(ls,"C0",ls.C0,c0NA.ls*CFrame.new(0,0,-.5)*CFrame.Angles(math.pi/3,0,-math.pi/4),5,true)
  323.     TweenWeld(tw,"C0",tw.C0,c0NA.tw*CFrame.Angles(0,-math.pi/3,0),5,true)
  324.     TweenWeld(hw,"C0",hw.C0,c0NA.nk*CFrame.Angles(0,math.pi/4,0),5,true)
  325.     TweenWeld(handlew,"C0",handlew.C0,ohw*CFrame.Angles(0,-math.pi/2,math.pi/2),5,true)
  326.     slashset.last = tick()
  327.     repeat wait()until (tick()-slashset.last)>4 or slashset.clicked
  328.     if slashset.clicked then
  329.         slashset.clicked = false
  330.         Slash()
  331.     end
  332.     returnToOriginal(15)
  333.     Attacking = false
  334. end
  335. function KS(victim)
  336.     Attacking = true
  337.     humanoid.WalkSpeed = 0
  338.     tweenLegs = true
  339.     local t = victim:FindFirstChild("Torso")
  340.     target = t
  341.     local h
  342.     for _,v in pairs(victim:children())do if v:IsA("Humanoid") then h = v end end
  343.     TweenWeld(rs,"C0",rs.C0,c0NA.rs*CFrame.new(.5,-.5,0)*CFrame.Angles(0,0,math.pi/2),5,true)
  344.     TweenWeld(ls,"C0",ls.C0,c0NA.ls*CFrame.new(-.5,-.5,0)*CFrame.Angles(0,0,-math.pi/2),5)
  345.     TweenWeld(rs,"C0",rs.C0,rs.C0,5,true)
  346.     TweenWeld(ls,"C0",ls.C0,ls.C0,5,true)
  347.     TweenWeld(rh,"C0",rh.C0,c0NA.rh*CFrame.new(0,.5,0)*CFrame.Angles(math.pi/5,0,0),5,true)
  348.     TweenWeld(lh,"C0",lh.C0,c0NA.lh*CFrame.new(0,.5,0)*CFrame.Angles(-math.pi/5,0,0),5,true)
  349.     TweenWeld(tw,"C0",tw.C0,c0.tw*CFrame.Angles(0,0,math.pi/2),5,true)
  350.     TweenWeld(hw,"C0",hw.C0,c0.nk,5,true)
  351.     TweenWeld(handlew,"C0",handlew.C0,ohwNA*CFrame.Angles(0,0,math.pi),5,true)
  352.     c(function()
  353.         repeat wait()
  354.             h.WalkSpeed = 0
  355.             h.PlatformStand = true
  356.         until not Attacking
  357.     end)
  358.     Spin = true
  359.     Rad = 0
  360.     quickSound(asset..sounds["hit"])
  361.     repeat wait()
  362.     until Rad >= 360
  363.     Spin = false
  364.     returnToOriginal(10,true)
  365.     target = nil
  366.     tweenLegs = false
  367.     humanoid.WalkSpeed = 16
  368.     Attacking = false
  369. end
  370. ------------------------------------------------------------------------
  371.  
  372. ------------------------------------------------------------------------
  373. Events["ButtonDown"] = mouse.Button1Down:connect(function()
  374.     if not Attacking then
  375.         PrepareSlash()
  376.     else
  377.         slashset.clicked = true
  378.     end
  379. end)
  380. Events["KeyDown"] = mouse.KeyDown:connect(function(key)
  381.     key:lower()
  382.     local p = findClosestPlayer(torso.CFrame,4)
  383.     if key=="q"and not Attacking and p then
  384.         KS(p)
  385.     end
  386. end)
  387. count = 0
  388. angle = 0
  389. counttime = 100
  390. countspeed = 1
  391. speed = .3
  392. Events["Loop"] = step:connect(function()
  393.     count = (count%counttime)+countspeed
  394.     angle = math.pi*math.sin((math.pi*2)/counttime*count)
  395.     rootVel = Vector3.new(root.Velocity.x,0,root.Velocity.z)
  396.     if target and not Spin then
  397.         bg.cframe = CFrame.new(CFrame.new(root.CFrame.x,root.CFrame.y,root.CFrame.z).p,CFrame.new(target.CFrame.x,root.CFrame.y,target.CFrame.z).p)
  398.     elseif not target and not Spin then
  399.         bg.cframe = CFrame.new(CFrame.new(root.CFrame.x,root.CFrame.y,root.CFrame.z).p,CFrame.new(camera.CoordinateFrame.x,root.CFrame.y,camera.CoordinateFrame.z).p)*CFrame.Angles(0,math.pi,0)
  400.     elseif Spin then
  401.         Rad = Rad + 10
  402.         bg.cframe = CFrame.new(root.CFrame.x,root.CFrame.y,root.CFrame.z)*CFrame.Angles(0,math.rad(Rad),0)
  403.     end
  404.     if rootVel.magnitude > 2 and not tweenLegs then
  405.         counttime = 25
  406.         countspeed = .75
  407.         speed = .4
  408.         lh.C0 = cslerp(lh.C0,c0.lh*CFrame.Angles(-angle*speed*.75,0,-angle*speed*.1),speed)
  409.         rh.C0 = cslerp(rh.C0,c0.rh*CFrame.Angles(angle*speed*.75,0,-angle*speed*.1),speed)
  410.     elseif rootVel.magnitude < 2 and not tweenLegs then
  411.         lh.C0 = cslerp(lh.C0,c0.lh,speed)
  412.         rh.C0 = cslerp(rh.C0,c0.rh,speed)
  413.     end
  414. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement