Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local next=next
- local gravity=0.09
- local friction=0.9
- local bounce=0.8
- local drag=Instance.new("Part",workspace)
- drag.Name="Dragger"
- drag.Anchored=true
- drag.CanCollide=false
- drag.Locked=true
- deselected=true
- drag.Transparency=1
- drag.Position=Vector3.new(0,50,0)
- local player=game.Players.LocalPlayer
- local char=player.Character
- local torso=player.Character.Torso
- local humanoid=player.Character.Humanoid
- local head=player.Character.Head
- local camera=workspace.CurrentCamera
- local RA=char["Right Arm"]
- local LA=char["Left Arm"]
- local RL=char["Right Leg"]
- local LL=char["Left Leg"]
- local RS=char.Torso["Right Shoulder"]
- local LS=char.Torso["Left Shoulder"]
- local T=char.Torso
- local mouse=player:GetMouse()
- local speed=100
- local slashing=false
- local spinning=false
- local swiping=false
- local function dist(p0,p1)
- local dx=p1.CFrame.x-p0.CFrame.x
- local dy=p1.CFrame.y-p0.CFrame.y
- local dz=p1.CFrame.z-p0.CFrame.z
- return math.sqrt(dx*dx+dy*dy+dz*dz)
- end
- local points={}
- local joints={}
- local handle=Instance.new("Part",player.Character)
- handle.Name="Handle"
- handle.Size=Vector3.new(.5,3,.5)
- handle.Transparency=0
- handle.Anchored=true
- handle.CanCollide=false
- handle.BrickColor=BrickColor.new("New Yeller")
- local cymesh=Instance.new("CylinderMesh",handle)
- cymesh.Scale=Vector3.new(0.5,1,0.5)
- local function createPoint(x,y,z,pinned)
- local t = {x=x,y=y,z=z,oldx=x-0.4,oldy=y-0.4,oldz=z-0.4,pinned=pinned}
- points[#points+1]=t
- return t
- end
- local function createJoint(point1,point2,distance,line)
- local t = {point1=point1,point2=point2,distance=distance,line=line}
- table.insert(joints,t)
- end
- local function drawLine()
- for i=1,#joints do
- local j=joints[i]
- local line=j.line
- if not line then
- line=Instance.new("Part",player.Character)
- line.Name=tostring(i)
- line.Anchored=true
- line.CanCollide=false
- line.BottomSurface="Smooth"
- line.TopSurface="Smooth"
- j.line=line
- if line.Name~=tostring(#joints) then
- local mesh=Instance.new("SpecialMesh",line)
- mesh.Name="Mesh"
- mesh.MeshId="http://www.roblox.com/asset/?id=3270017"
- mesh.Scale=Vector3.new(0.4,0.6,0.6)
- else
- local mesh=Instance.new("CylinderMesh",line)
- mesh.Scale=Vector3.new(1,3,1)
- coroutine.resume(coroutine.create(function()
- line.Touched:connect(function(hit)
- pcall(function()
- if hit.Parent.Parent:IsA("Model") then
- local playerHit=game.Players:GetPlayerFromCharacter(hit.Parent.Parent)
- if playerHit then
- if playerHit.Name~="Voreli" then
- if playerHit.Character:FindFirstChild("Humanoid") then
- playerHit.Character.Humanoid.Health=playerHit.Character.Humanoid.Health-5
- end
- end
- end
- end
- end)
- end)
- end))
- end
- end
- local dx=j.point2.x-j.point1.x
- local dy=j.point2.y-j.point1.y
- local dz=j.point2.z-j.point1.z
- line.BrickColor=BrickColor.new("Really Blue")
- line.Size=Vector3.new(1,1,1)
- local distance=math.sqrt(dx*dx+dy*dy+dz*dz)
- if line.Name~=tostring(#joints) then
- line.BrickColor=BrickColor.new("Really blue")
- line.Size=Vector3.new(1,1,1)
- else
- line.BrickColor=BrickColor.new("New Yeller")
- line.Size=Vector3.new(0.2,1,0.2)
- end
- if line.Name~=tostring(#joints) then
- if tonumber(line.Name)%2==0 then
- line.CFrame=CFrame.new(Vector3.new(j.point1.x,j.point1.y,j.point1.z),Vector3.new(j.point2.x,j.point2.y,j.point2.z))*CFrame.Angles(math.rad(100),0,0)
- *CFrame.new(0,0,-distance/2)
- line.CFrame=line.CFrame*CFrame.Angles(0,math.rad(100),0)
- else
- line.CFrame=CFrame.new(Vector3.new(j.point1.x,j.point1.y,j.point1.z),Vector3.new(j.point2.x,j.point2.y,j.point2.z))*CFrame.Angles(math.rad(100),0,0)
- *CFrame.new(0,0,-distance/2)
- end
- else
- line.CFrame=CFrame.new(Vector3.new(j.point1.x,j.point1.y,j.point1.z),Vector3.new(j.point2.x,j.point2.y,j.point2.z))*CFrame.Angles(math.rad(100),0,0)
- *CFrame.new(0,-1.2,-distance/2)
- end
- end
- end
- local width=1
- local height=5
- local l=0.45
- for y=1,height do
- for x=1,width do
- createPoint(l*x,25-l*y,0,y==1)
- if x>1 then
- createJoint(points[width*(y-1)+x-1],points[width*(y-1)+x],l)
- end
- if y>1 then
- createJoint(points[width*(y-2)+x],points[width*(y-1)+x],l)
- end
- end
- end
- --[[local rlad=dist(RA,LA)
- local rlld=dist(RL,LL)
- local rlald=dist(RA,LL)
- local rllad=dist(LA,RL)
- local rrla=dist(RA,RL)
- local llla=dist(LL,LA)
- local rat=dist(RA,torso)
- local lat=dist(LA,torso)
- local rlt=dist(RL,torso)
- local llt=dist(LL,torso)
- local ra1=createPoint(RA.CFrame.X,RA.CFrame.Y,RA.CFrame.Z,false)
- local la1=createPoint(LA.CFrame.X,LA.CFrame.Y,LA.CFrame.Z,false)
- local rl1=createPoint(RL.CFrame.X,RL.CFrame.Y,RL.CFrame.Z,false)
- local ll1=createPoint(LL.CFrame.X,LL.CFrame.Y,LL.CFrame.Z,false)
- local tt=createPoint(torso.CFrame.X,torso.CFrame.Y,torso.CFrame.Z,false)
- createJoint(ra1,la1,rlad)
- createJoint(rl1,ll1,rlld)
- createJoint(tt,ra1,rat)
- createJoint(tt,la1,lat)
- createJoint(]]
- local function updatePoints()
- for i=1,#points do
- local p=points[i]
- if not p.pinned then
- local vx=(p.x-p.oldx)*friction;
- local vy=-((p.y-p.oldy)*friction);
- local vz=(p.z-p.oldz)*friction;
- p.oldx=p.x
- p.oldy=p.y
- p.oldz=p.z
- p.x=p.x+vx
- p.y=p.y-vy
- p.z=p.z+vz
- p.y=p.y-gravity
- if p.y<0 then
- p.y=0
- end
- end
- end
- end
- local function updateSticks()
- for i=1,#joints do
- local j=joints[i]
- local dx=j.point2.x-j.point1.x
- local dy=j.point2.y-j.point1.y
- local dz=j.point2.z-j.point1.z
- local distance=math.sqrt(dx*dx+dy*dy+dz*dz)
- local difference=j.distance-distance
- local percent=difference/distance/2
- local offsetX=dx*percent;
- local offsetY=dy*percent;
- local offsetZ=dz*percent;
- if j.point1.pinned or j.point2.pinned then
- offsetX=offsetX*2
- offsetY=offsetY*2
- offsetZ=offsetZ*2
- end
- if not j.point1.pinned then
- j.point1.x=j.point1.x-offsetX
- j.point1.y=j.point1.y-offsetY
- j.point1.z=j.point1.z-offsetZ
- end
- if not j.point2.pinned then
- j.point2.x=j.point2.x+offsetX
- j.point2.y=j.point2.y+offsetY
- j.point2.z=j.point2.z+offsetZ
- end
- end
- end
- local function Swipe()
- swiping=true
- for i=1,6,1 do
- RS.C0=RS.C0*CFrame.Angles(0,0,math.rad(i*10))
- wait()
- end
- for i=1,6,1 do
- RS.C0=RS.C0*CFrame.Angles(0,0,math.rad(-i*15))
- wait()
- end
- for i=1,6,1 do
- RS.C0=RS.C0*CFrame.Angles(0,0,math.rad(i*5))
- wait()
- end
- swiping=false
- end
- local function StartSpin()
- spinning=true
- for i=1,math.huge do
- if spinning==true then
- T.CFrame=T.CFrame*CFrame.Angles(0,math.rad(50),0)
- wait()
- else
- break
- end
- end
- end
- local function StopSpin()
- spinning=false
- end
- mouse.Button1Down:connect(function()
- if not swiping and not slashing and not spinning then
- Swipe()
- end
- end)
- mouse.KeyDown:connect(function(key)
- if key=="q" then
- if spinning~=true then
- StartSpin()
- else
- spinning=false
- end
- end
- end)
- game:service'RunService'.Stepped:connect(function()
- handle.CFrame=RA.CFrame*CFrame.new(0.1,-.3,-1.4)
- handle.CFrame=handle.CFrame*CFrame.Angles(-180,0,0)
- for i=1,width do
- local pos=RA.CFrame*CFrame.new(0.3,0.35,-2.5)
- points[i].x=pos.x
- points[i].y=pos.y
- points[i].z=pos.z
- end
- updatePoints()
- for i=1,15 do
- updateSticks()
- end
- drawLine()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement