Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- r = game:service("RunService")
- local damage = 0
- local slash_damage = 100
- sword = script.Parent.Handle
- Tool = script.Parent
- local arms = nil
- local torso = nil
- local welds = {}
- function Equip(mouse)
- wait(0.01)
- arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
- torso = Tool.Parent:FindFirstChild("Torso")
- if arms ~= nil and torso ~= nil then
- local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
- if sh ~= nil then
- local yes = true
- if yes then
- yes = false
- sh[1].Part1 = nil
- sh[2].Part1 = nil
- local weld1 = Instance.new("Weld")
- weld1.Part0 = torso
- weld1.Parent = torso
- weld1.Part1 = arms[1]
- weld1.C1 = CFrame.new(1.5,0,0) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, math.rad(0))
- welds[1] = weld1
- local weld2 = Instance.new("Weld")
- weld2.Part0 = torso
- weld2.Parent = torso
- weld2.Part1 = arms[2]
- weld2.C1 = CFrame.new(-1.2, 0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
- welds[2] = weld2
- end
- else
- print("sh")
- end
- else
- print("arms")
- end
- end
- function Unequip(mouse)
- if arms ~= nil and torso ~= nil then
- local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
- if sh ~= nil then
- local yes = true
- if yes then
- yes = false
- sh[1].Part1 = arms[1]
- sh[2].Part1 = arms[2]
- welds[1].Parent = nil
- welds[2].Parent = nil
- end
- else
- print("sh")
- end
- else
- print("arms")
- end
- end
- Tool.Equipped:connect(Equip)
- Tool.Unequipped:connect(Unequip)
- function blow(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- local vCharacter = Tool.Parent
- local vPlayer = game.Players:playerFromCharacter(vCharacter)
- local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
- if humanoid~=nil and humanoid ~= hum and hum ~= nil then
- print("SWORD HIT")
- tagHumanoid(humanoid, vPlayer)
- humanoid:TakeDamage(damage)
- wait(1)
- untagHumanoid(humanoid)
- end
- end
- function tagHumanoid(humanoid, player)
- local creator_tag = Instance.new("ObjectValue")
- creator_tag.Value = player
- creator_tag.Name = "creator"
- creator_tag.Parent = humanoid
- end
- function untagHumanoid(humanoid)
- if humanoid ~= nil then
- local tag = humanoid:findFirstChild("creator")
- if tag ~= nil then
- tag.Parent = nil
- end
- end
- end
- function attack()
- damage = slash_damage
- local anim = Instance.new("StringValue")
- anim.Name = "toolanim"
- anim.Value = "Slash"
- anim.Parent = Tool
- local weld1 = Instance.new("Weld")
- weld1.Part0 = torso
- weld1.Parent = torso
- weld1.Part1 = arms[1]
- weld1.C1 = CFrame.new(1.5,.4,.5) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(0))
- welds[1] = weld1
- local weld2 = Instance.new("Weld")
- weld2.Part0 = torso
- weld2.Parent = torso
- weld2.Part1 = arms[2]
- weld2.C1 = CFrame.new(-1.2, 0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
- welds[2] = weld2
- Tool.GripForward = Vector3.new(-0, -0, -1)
- Tool.GripPos = Vector3.new(0,0,0)
- Tool.GripRight = Vector3.new(-1e-005, 1, 0)
- Tool.GripUp = Vector3.new(-1, -1e-005, 0)
- wait(0.125)
- weld1.C1 = CFrame.new(1.5,0,0) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, math.rad(0))
- weld2.C1 = CFrame.new(-1.2, 0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-50), 0)
- wait(0.0625)
- weld1.C1 = CFrame.new(1.5,0,0) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, math.rad(0))
- weld2.C1 = CFrame.new(-1.2, 0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-100), 0)
- wait(0.2)
- weld1.C1 = CFrame.new(1.5,0,0) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, math.rad(0))
- weld2.C1 = CFrame.new(-1.2, 0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
- wait(0.0625)
- Tool.GripForward = Vector3.new(-0,-0,-1)
- Tool.GripPos = Vector3.new(0,0,0)
- Tool.GripRight = Vector3.new(-1, 0, 0)
- Tool.GripUp = Vector3.new(0, -1, 0)
- end
- function swordUp()
- Tool.GripForward = Vector3.new(-0, -0, -1)
- Tool.GripPos = Vector3.new(0,0,0)
- Tool.GripRight = Vector3.new(-1e-005, 1, 0)
- Tool.GripUp = Vector3.new(-1, -1e-005, 0)
- end
- function swordOut()
- Tool.GripForward = Vector3.new(-0,-0,-1)
- Tool.GripPos = Vector3.new(0,0,0)
- Tool.GripRight = Vector3.new(-1, 0, 0)
- Tool.GripUp = Vector3.new(0, -1, 0)
- end
- function swordAcross()
- -- parry
- end
- Tool.Enabled = true
- local last_attack = 0
- function onActivated()
- if not Tool.Enabled then
- return
- end
- Tool.Enabled = false
- local character = Tool.Parent;
- local humanoid = character.Humanoid
- if humanoid == nil then
- print("Humanoid not found")
- return
- end
- t = r.Stepped:wait()
- attack()
- last_attack = t
- --wait(.5)
- Tool.Enabled = true
- end
- function onEquipped()
- end
- script.Parent.Activated:connect(onActivated)
- script.Parent.Equipped:connect(onEquipped)
- connection = script.Parent.Handle10.Touched:connect(blow) or script.Parent.Handle11.Touched:connect(blow) or script.Parent.Handle12.Touched:connect(blow) or dscript.Parent.Handle13.Touched:connect(blow) or script.Parent.Handle14.Touched:connect(blow) or script.Parent.Handle15.Touched:connect(blow)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement