Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- > Made by wulfbug9.
- -- > Unfinished, never going to work on it again.
- -- > Enjoy.
- ------------------------------------------------------------------------ useful functions
- function r(n) return (math.random()-.5)*2*n end
- function c(func,args) coroutine.resume(coroutine.create(func),unpack(args or {})) end
- function Part(Name,Parent,Size,CFrame,Color,Trans,Anch,Can,Mat)
- local surfaces = {"Front","Back","Left","Right","Top","Bottom"}
- local p = Instance.new("Part",Parent)p.Name = Name
- p.FormFactor = "Custom"p.Size = Size
- p.Anchored = Anch p.CFrame = CFrame
- p.BrickColor = BrickColor.new(Color)p.Transparency = Trans
- p.CanCollide = Can;p.Material = Mat
- p:BreakJoints();p.Locked = true
- for i=1,#surfaces do p[surfaces[i].."Surface"] = 10 end
- return p
- end
- function WedgePart(Name,Parent,Size,CFrame,Color,Trans,Anch,Can,Mat)
- local surfaces = {"Front","Back","Left","Right","Top","Bottom"}
- local p = Instance.new("WedgePart",Parent)p.Name = Name
- p.FormFactor = "Custom"p.Size = Size
- p.Anchored = Anch p.CFrame = CFrame
- p.BrickColor = BrickColor.new(Color)p.Transparency = Trans
- p.CanCollide = Can;p.Material = Mat
- p:BreakJoints();p.Locked = true
- for i=1,#surfaces do p[surfaces[i].."Surface"] = 10 end
- return p
- end
- function Mesh(Parent,Type,Scale,ID,TID)
- local m = Instance.new("SpecialMesh",Parent)m.MeshType = Type
- m.Scale = Scale or Vector3.new(1,1,1)
- if ID then m.MeshId = ID end if TID then m.TextureId = TID end
- return m
- end
- function Weld(p1,p2,c0,c1)
- local w = Instance.new("Weld",p1)w.Part0 = p1;w.Part1 = p2
- w.C0,w.C1 = c0 or CFrame.new(),c1 or CFrame.new()
- return w
- end
- function rayCast(pos,dir,ign)
- ign = ign or {char}
- return workspace:FindPartOnRayWithIgnoreList(Ray.new(pos,dir),ign)
- end
- ------------------------------------------------------------------------
- Tween = {}
- function slerp(a,b,c)return (1-c)*a+(c*b)end
- function cslerp(start,destination,increment)
- local c1 = {start.X,start.Y,start.Z,start:toEulerAnglesXYZ()}
- local c2 = {destination.X,destination.Y,destination.Z,destination:toEulerAnglesXYZ()}
- for i,v in pairs(c1)do c1[i] = slerp(v,c2[i],increment)end
- return CFrame.new(c1[1],c1[2],c1[3])*CFrame.Angles(c1[4],c1[5],c1[6])
- end
- function TweenWeld(weld,type,start,finish,speed,sync)
- if Tween[weld] and Tween[weld][1] == true then return end
- Tween[weld] = {weld,true}
- local function T()
- for i=1,speed do
- local s = i/speed
- weld[type] = cslerp(start,finish,s)
- game:service("RunService").Stepped:wait()
- end
- Tween[weld] = {weld,false}
- end
- if sync then coroutine.wrap(T)() else T() end
- end
- ------------------------------------------------------------------------ variables
- player = game:service("Players").LocalPlayer
- local char
- repeat wait() char = player.Character until char
- root = char:WaitForChild("HumanoidRootPart")
- torso = char:WaitForChild("Torso")
- humanoid = char:WaitForChild("Humanoid")
- head = char:WaitForChild("Head")
- bodycolours = char:WaitForChild("Body Colors")
- mouse = player:GetMouse()
- step = game:service("RunService").RenderStepped
- camera = workspace.CurrentCamera
- asset = "http://www.roblox.com/asset/?id="
- meshes = {["blast"] = 20329976,["ring"] = 3270017,["spike"] = 1033714,["cone"] = 1082802,["crown"] = 20329976,["cloud"] = 1095708,["diamond"] = 9756362}
- sounds = {["explode"] = 130792180;["spin"] = 147722227;["patrick"] = 135290668;["hit"] = 146163493}
- torsomesh = "rbxasset://fonts/torso.mesh"
- Attacking = false
- Trailing = true
- target = nil
- tweenLegs = false
- Events = setmetatable({},{ -- kinda useless in this script but eh
- __nexindex = function(self,Index,Value)
- local T = {}
- T.Name = Index
- T.Event = Value
- table.insert(self,T)
- end;
- __call = function(self,Index)
- for i,v in pairs(self) do
- if v.Name == Index then
- return true,v.Event
- end
- end
- return false,nil
- end;
- })
- c0 = {
- ls = CFrame.new(-1,0.5,0)*CFrame.new(.5,0,0)*CFrame.Angles(math.pi/3,0,math.pi/4),
- rs = CFrame.new(1,0.5,0)*CFrame.new(-.3,0,0)*CFrame.Angles(math.pi/3,0,-math.pi/10),
- lh = CFrame.new(-1,-1,0),
- rh = CFrame.new(1,-1,0),
- nk = CFrame.new(0,1,0)*CFrame.Angles(0,math.pi/9,0),
- tw = CFrame.new(0,0,0)*CFrame.Angles(0,-math.pi/9,0),
- }
- c0NA = {
- ls = CFrame.new(-1,0.5,0),
- rs = CFrame.new(1,0.5,0),
- lh = CFrame.new(-1,-1,0),
- rh = CFrame.new(1,-1,0),
- nk = CFrame.new(0,1,0),
- tw = CFrame.new(0,0,0),
- }
- c1 = {
- ls = CFrame.new(0.5,0.5,0),
- rs = CFrame.new(-0.5,0.5,0),
- lh = CFrame.new(-.5,1,0),
- rh = CFrame.new(.5,1,0),
- nk = CFrame.new(0,-.5,0),
- tw = CFrame.new(0,0,0),
- }
- slashset = {
- last = tick();
- clicked = false;
- }
- combo1set = {
- last = tick();
- clicked = false;
- }
- Spin,Rad = false,0
- Mode = "Slash"
- bg = Instance.new("BodyGyro",root)
- bg.maxTorque = Vector3.new(1,1,1)*10^6
- bg.P = 10^4
- rs = Weld(torso,char:WaitForChild("Right Arm"),c0.rs,c1.rs)
- ls = Weld(torso,char:WaitForChild("Left Arm"),c0.ls,c1.ls)
- rh = Weld(torso,char:WaitForChild("Right Leg"),c0.rh,c1.rh)
- lh = Weld(torso,char:WaitForChild("Left Leg"),c0.lh,c1.lh)
- tw = Weld(root,torso,c0.tw)
- hw = Weld(torso,head,c0.nk,c1.nk)
- colour = {"Black","Tr. Yellow","Bright yellow"}
- --{"Black","Medium red","Bright red"}
- --{"Black","Pastel blue-green","Teal"}
- --{"Black","Tr. Red","Red flip/flop"}
- --{"Black","Tr. Yellow","Bright yellow"}
- --{"Black","Med. yellowish orange","Bright orange"}
- local model,ohw
- ------------------------------------------------------------------------ effects & functions
- function quickSound(id,v,p)
- local s = Instance.new("Sound",workspace)
- s.SoundId = id
- s.PlayOnRemove = true
- s.Volume = v or 1
- s.Pitch = p or 1
- delay(0.025,function()s:remove()end)
- end
- function checkDmgArea(origin,dmg,d)
- for i,v in pairs(workspace:children())do
- if v~=char and v:FindFirstChild("Torso") then
- local h;
- for _,k in pairs(v:children())do if k:IsA("Humanoid") then h = k end end
- local dist = (origin.p - v:FindFirstChild("Torso").CFrame.p).magnitude
- if dist < d and h~=nil then
- h.Health = h.Health - dmg
- end
- end
- end
- end
- function findClosestPlayer(origin,d)
- local bdist,plr = d,nil
- for i,v in pairs(workspace:children())do
- if v~=char and v:FindFirstChild("Torso") then
- local h;
- for _,k in pairs(v:children())do if k:IsA("Humanoid") then h = k end end
- local dist = (origin.p - v:FindFirstChild("Torso").CFrame.p).magnitude
- if dist < bdist and h~=nil and h.Health~=0 then
- bdist,plr = dist,v
- end
- end
- end
- return plr,bdist
- end
- function drawLine(mag,one,two)
- 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")
- c(function(p,m)
- for i=1,0,-.05 do
- m.Scale = Vector3.new(i,1,i)
- wait(1/30)
- end
- p:Destroy()
- end,{t,Instance.new("CylinderMesh",t)})
- end
- function Trail(part)
- Trailing = true
- local lastPos = part.CFrame.p
- local tik = tick()
- local tim = .025
- local loop;
- loop = game:service("RunService").RenderStepped:connect(function()
- if (tick()-tik)>tim and Trailing then
- local dist = (lastPos-part.CFrame.p).magnitude
- drawLine(dist,lastPos,part.CFrame.p)
- lastPos = part.CFrame.p
- tik = tick()
- elseif not Trailing then
- loop:disconnect()
- end
- end)
- end
- ------------------------------------------------------------------------ build the weapon
- pcall(function()char:FindFirstChild("Weapon"):Destroy()end)
- model = Instance.new("Model",char)
- model.Name = "Weapon"
- handle = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[1],0,false,false,"Plastic")
- handlem = Instance.new("CylinderMesh",handle)
- handlem.Scale = Vector3.new(.8,1,.8)
- handlew = Weld(char:FindFirstChild("Right Arm"),handle,CFrame.new(-.4,-1.1,0)*CFrame.Angles(-math.pi/2,math.pi/2,0))
- p1 = Part("",model,Vector3.new(0.25,0.25,0.25),torso.CFrame,colour[2],0,false,false,"Plastic")
- p1m = Instance.new("CylinderMesh",p1)
- p1w = Weld(handle,p1,CFrame.new(0,-.5,0))
- p2 = Part("",model,Vector3.new(0.3,0,0.3),torso.CFrame,colour[3],0,false,false,"Plastic")
- p2m = Instance.new("CylinderMesh",p2)
- p2w = Weld(p1,p2,CFrame.new(0,-.125,0))
- p3 = Part("",model,Vector3.new(0.25,0.25,0.25),torso.CFrame,colour[2],0,false,false,"Plastic")
- p3m = Instance.new("CylinderMesh",p3)
- p3w = Weld(handle,p3,CFrame.new(0,.5,0))
- p4 = Part("",model,Vector3.new(0.3,0,0.3),torso.CFrame,colour[3],0,false,false,"Plastic")
- p4m = Instance.new("CylinderMesh",p4)
- p4w = Weld(p3,p4,CFrame.new(0,.125,0))
- div = Part("",model,Vector3.new(2,0,.3),torso.CFrame,colour[1],0,false,false,"Plastic")
- divw = Weld(handle,div,CFrame.new(0,.75,0))
- p5 = Part("",model,Vector3.new(0,0,0),torso.CFrame,colour[1],0,false,false,"Plastic")
- p5m = Mesh(p5,"FileMesh",Vector3.new(.15,1,.15),asset..meshes["spike"])
- p5w = Weld(div,p5,CFrame.new(-1,.3,0)*CFrame.Angles(0,0,math.pi/6))
- p6 = Part("",model,Vector3.new(0,0,0),torso.CFrame,colour[1],0,false,false,"Plastic")
- p6m = Mesh(p6,"FileMesh",Vector3.new(.15,1,.15),asset..meshes["spike"])
- p6w = Weld(div,p6,CFrame.new(1,.3,0)*CFrame.Angles(0,0,-math.pi/6))
- blade = Part("",model,Vector3.new(1.5,4,0),torso.CFrame,colour[2],0.5,false,false,"SmoothPlastic")
- bladem = Mesh(blade,"Brick",Vector3.new(1.025,1,1))
- bladew = Weld(div,blade,CFrame.new(0,2,0))
- for i=1,9 do
- local angle = math.pi*2/9*i
- local p = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
- local pm = Mesh(p,"FileMesh",Vector3.new(.075,.1475,.125),torsomesh)
- 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))
- end
- for i=1,6 do
- local angle = math.pi*2/6*i
- local p = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
- local pm = Mesh(p,"FileMesh",Vector3.new(.075,.1475,.125),torsomesh)
- 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))
- local p2 = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
- local p2m = Mesh(p2,"FileMesh",Vector3.new(.075,.1475,.125),torsomesh)
- 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))
- local p3 = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
- local p3m = Mesh(p3,"FileMesh",Vector3.new(.075,.1475,.125),torsomesh)
- 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))
- end
- local tip
- local y = 2.15
- for i=1.5,0,-.5 do
- local p = Part("",model,Vector3.new(0,0,i),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
- local pm = Mesh(p,"Brick")
- local pw = Weld(blade,p,CFrame.Angles(0,math.pi/2,0)*CFrame.new(0,y,0))
- y = y + .25
- if i==0 then tip = p end
- end
- bp = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
- bpm = Mesh(bp,"FileMesh",Vector3.new(.075,.215,.125),torsomesh)
- bpw = Weld(blade,bp,CFrame.Angles(0,math.pi/2,0)*CFrame.new(0,-.4,-.25)*CFrame.Angles(math.pi/6,0,0))
- bp2 = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
- bp2m = Mesh(bp2,"FileMesh",Vector3.new(.075,.215,.125),torsomesh)
- bp2w = Weld(blade,bp2,CFrame.Angles(0,math.pi/2,0)*CFrame.new(0,-.7,-.25)*CFrame.Angles(-math.pi/6,0,0))
- bp3 = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
- bp3m = Mesh(bp3,"FileMesh",Vector3.new(.075,.215,.125),torsomesh)
- bp3w = Weld(blade,bp3,CFrame.Angles(0,math.pi/2,0)*CFrame.new(0,-.4,.25)*CFrame.Angles(-math.pi/6,0,0))
- bp4 = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
- bp4m = Mesh(bp4,"FileMesh",Vector3.new(.075,.215,.125),torsomesh)
- bp4w = Weld(blade,bp4,CFrame.Angles(0,math.pi/2,0)*CFrame.new(0,-.7,.25)*CFrame.Angles(math.pi/6,0,0))
- bp5 = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
- bp5m = Mesh(bp5,"FileMesh",Vector3.new(.075,1.4,.125),torsomesh)
- bp5w = Weld(blade,bp5,CFrame.Angles(0,math.pi/2,0)*CFrame.new(0,-.55,.5))
- bp6 = Part("",model,Vector3.new(0,1,0),torso.CFrame,colour[3],0,false,false,"SmoothPlastic")
- bp6m = Mesh(bp6,"FileMesh",Vector3.new(.075,1.4,.125),torsomesh)
- bp6w = Weld(blade,bp6,CFrame.Angles(0,math.pi/2,0)*CFrame.new(0,-.55,-.5))
- ohw,ohwNA = handlew.C0,CFrame.new(-.4,-1.1,0)
- ------------------------------------------------------------------------ attacks
- function returnToOriginal(speed,legbool)
- TweenWeld(rs,"C0",rs.C0,c0.rs,speed,true)
- TweenWeld(ls,"C0",ls.C0,c0.ls,speed,true)
- if legbool then
- TweenWeld(rh,"C0",rh.C0,c0.rh,speed,true)
- TweenWeld(lh,"C0",lh.C0,c0.lh,speed,true)
- end
- TweenWeld(tw,"C0",tw.C0,c0.tw,speed,true)
- TweenWeld(hw,"C0",hw.C0,c0.nk,speed,true)
- TweenWeld(handlew,"C0",handlew.C0,ohw,speed)
- end
- function Slash()
- Trail(tip)
- c(function()
- while wait()and Attacking do
- checkDmgArea(blade.CFrame,5,4)
- end
- end)
- TweenWeld(rs,"C0",rs.C0,c0NA.rs*CFrame.new(.25,0,-.5)*CFrame.Angles(math.pi/1.75,0,math.pi/2),5,true)
- TweenWeld(ls,"C0",ls.C0,c0NA.ls*CFrame.new(0,0,-.5)*CFrame.Angles(math.pi/3,0,-math.pi/4),5,true)
- TweenWeld(tw,"C0",tw.C0,c0NA.tw*CFrame.Angles(0,math.pi/2,0),5,true)
- TweenWeld(hw,"C0",hw.C0,c0NA.nk*CFrame.Angles(0,-math.pi/2,0),5,true)
- TweenWeld(handlew,"C0",handlew.C0,ohwNA*CFrame.Angles(0,0,math.pi),5)
- Trailing = false
- end
- function PrepareSlash()
- Attacking = true
- slashset.clicked = false
- TweenWeld(rs,"C0",rs.C0,c0NA.rs*CFrame.new(0,0,-.5)*CFrame.Angles(math.pi/1.75,0,math.pi/4),5,true)
- TweenWeld(ls,"C0",ls.C0,c0NA.ls*CFrame.new(0,0,-.5)*CFrame.Angles(math.pi/3,0,-math.pi/4),5,true)
- TweenWeld(tw,"C0",tw.C0,c0NA.tw*CFrame.Angles(0,-math.pi/3,0),5,true)
- TweenWeld(hw,"C0",hw.C0,c0NA.nk*CFrame.Angles(0,math.pi/4,0),5,true)
- TweenWeld(handlew,"C0",handlew.C0,ohw*CFrame.Angles(0,-math.pi/2,math.pi/2),5,true)
- slashset.last = tick()
- repeat wait()until (tick()-slashset.last)>4 or slashset.clicked
- if slashset.clicked then
- slashset.clicked = false
- Slash()
- end
- returnToOriginal(15)
- Attacking = false
- end
- function KS(victim)
- Attacking = true
- humanoid.WalkSpeed = 0
- tweenLegs = true
- local t = victim:FindFirstChild("Torso")
- target = t
- local h
- for _,v in pairs(victim:children())do if v:IsA("Humanoid") then h = v end end
- TweenWeld(rs,"C0",rs.C0,c0NA.rs*CFrame.new(.5,-.5,0)*CFrame.Angles(0,0,math.pi/2),5,true)
- TweenWeld(ls,"C0",ls.C0,c0NA.ls*CFrame.new(-.5,-.5,0)*CFrame.Angles(0,0,-math.pi/2),5)
- TweenWeld(rs,"C0",rs.C0,rs.C0,5,true)
- TweenWeld(ls,"C0",ls.C0,ls.C0,5,true)
- TweenWeld(rh,"C0",rh.C0,c0NA.rh*CFrame.new(0,.5,0)*CFrame.Angles(math.pi/5,0,0),5,true)
- TweenWeld(lh,"C0",lh.C0,c0NA.lh*CFrame.new(0,.5,0)*CFrame.Angles(-math.pi/5,0,0),5,true)
- TweenWeld(tw,"C0",tw.C0,c0.tw*CFrame.Angles(0,0,math.pi/2),5,true)
- TweenWeld(hw,"C0",hw.C0,c0.nk,5,true)
- TweenWeld(handlew,"C0",handlew.C0,ohwNA*CFrame.Angles(0,0,math.pi),5,true)
- c(function()
- repeat wait()
- h.WalkSpeed = 0
- h.PlatformStand = true
- until not Attacking
- end)
- Spin = true
- Rad = 0
- quickSound(asset..sounds["hit"])
- repeat wait()
- until Rad >= 360
- Spin = false
- returnToOriginal(10,true)
- target = nil
- tweenLegs = false
- humanoid.WalkSpeed = 16
- Attacking = false
- end
- ------------------------------------------------------------------------
- ------------------------------------------------------------------------
- Events["ButtonDown"] = mouse.Button1Down:connect(function()
- if not Attacking then
- PrepareSlash()
- else
- slashset.clicked = true
- end
- end)
- Events["KeyDown"] = mouse.KeyDown:connect(function(key)
- key:lower()
- local p = findClosestPlayer(torso.CFrame,4)
- if key=="q"and not Attacking and p then
- KS(p)
- end
- end)
- count = 0
- angle = 0
- counttime = 100
- countspeed = 1
- speed = .3
- Events["Loop"] = step:connect(function()
- count = (count%counttime)+countspeed
- angle = math.pi*math.sin((math.pi*2)/counttime*count)
- rootVel = Vector3.new(root.Velocity.x,0,root.Velocity.z)
- if target and not Spin then
- 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)
- elseif not target and not Spin then
- 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)
- elseif Spin then
- Rad = Rad + 10
- bg.cframe = CFrame.new(root.CFrame.x,root.CFrame.y,root.CFrame.z)*CFrame.Angles(0,math.rad(Rad),0)
- end
- if rootVel.magnitude > 2 and not tweenLegs then
- counttime = 25
- countspeed = .75
- speed = .4
- lh.C0 = cslerp(lh.C0,c0.lh*CFrame.Angles(-angle*speed*.75,0,-angle*speed*.1),speed)
- rh.C0 = cslerp(rh.C0,c0.rh*CFrame.Angles(angle*speed*.75,0,-angle*speed*.1),speed)
- elseif rootVel.magnitude < 2 and not tweenLegs then
- lh.C0 = cslerp(lh.C0,c0.lh,speed)
- rh.C0 = cslerp(rh.C0,c0.rh,speed)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement