Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local combatknife = Instance.new("Tool", game.Players.LocalPlayer.Backpack)
- combatknife.Grip = CFrame.new(0, 0, 0)* CFrame.Angles(-1.5707963705063, 0, -1.5707963705063)
- combatknife.GripForward = Vector3.new(0, -1, 0)
- combatknife.Name = "Combatknife"
- combatknife.GripRight = Vector3.new(0, 0, 1)
- combatknife.GripUp = Vector3.new(1, 0, 0)
- local edge = Instance.new("Part", combatknife)
- edge.FormFactor = Enum.FormFactor.Custom
- edge.LeftSurface = Enum.SurfaceType.Weld
- edge.Transparency = 1
- edge.TopSurface = Enum.SurfaceType.Weld
- edge.Anchored = false
- edge.Size = Vector3.new(1.4, 0.4, 0.2)
- edge.Name = "Edge"
- edge.FrontSurface = Enum.SurfaceType.Weld
- edge.Locked = true
- edge.CFrame = CFrame.new(-4.6, 1.451, 2.911)* CFrame.Angles(-0.00022851390531287, -1.3008351325989, 1.5705379247665)
- edge.RightSurface = Enum.SurfaceType.Weld
- edge.BackSurface = Enum.SurfaceType.Weld
- edge.BrickColor = BrickColor.new("Dark grey metallic")
- edge.Friction = 0.3
- edge.BottomSurface = Enum.SurfaceType.Weld
- local mesh = Instance.new("BlockMesh", edge)
- mesh.Scale = Vector3.new(1, 1, 0.1)
- local decal = Instance.new("Decal", edge)
- decal.Texture = "http://www.roblox.com/asset/?id=41872978"
- local decal_2 = Instance.new("Decal", edge)
- decal_2.Face = Enum.NormalId.Back
- decal_2.Texture = "http://www.roblox.com/asset/?id=41873039"
- local edge_2 = Instance.new("Part", combatknife)
- edge_2.FormFactor = Enum.FormFactor.Custom
- edge_2.LeftSurface = Enum.SurfaceType.Weld
- edge_2.Transparency = 1
- edge_2.TopSurface = Enum.SurfaceType.Weld
- edge_2.Anchored = false
- edge_2.Size = Vector3.new(0.8, 0.4, 0.2)
- edge_2.Name = "Edge"
- edge_2.FrontSurface = Enum.SurfaceType.Weld
- edge_2.Locked = true
- edge_2.CFrame = CFrame.new(-4.6, 0.39, 2.911)* CFrame.Angles(-0.00023184972815216, -1.3008621931076, 1.5705318450928)
- edge_2.RightSurface = Enum.SurfaceType.Weld
- edge_2.BackSurface = Enum.SurfaceType.Weld
- edge_2.BrickColor = BrickColor.new("Dark grey metallic")
- edge_2.Friction = 0.3
- edge_2.BottomSurface = Enum.SurfaceType.Weld
- local mesh_2 = Instance.new("BlockMesh", edge_2)
- mesh_2.Scale = Vector3.new(1, 1, 0.1)
- local decal_3 = Instance.new("Decal", edge_2)
- decal_3.Texture = "http://www.roblox.com/asset/?id=41872988"
- local decal_4 = Instance.new("Decal", edge_2)
- decal_4.Face = Enum.NormalId.Back
- decal_4.Texture = "http://www.roblox.com/asset/?id=41873073"
- local handle = Instance.new("Part", combatknife)
- handle.FormFactor = Enum.FormFactor.Custom
- handle.LeftSurface = Enum.SurfaceType.Weld
- handle.TopSurface = Enum.SurfaceType.Weld
- handle.Anchored = false
- handle.Size = Vector3.new(0.8, 0.4, 0.2)
- handle.Name = "Handle"
- handle.FrontSurface = Enum.SurfaceType.Weld
- handle.Locked = true
- handle.CFrame = CFrame.new(-4.6, 2.545, 2.911)* CFrame.Angles(-8.5182124166749e-005, -1.3009506464005, 1.570799946785)
- handle.RightSurface = Enum.SurfaceType.Weld
- handle.BackSurface = Enum.SurfaceType.Weld
- handle.BrickColor = BrickColor.new("Bright red")
- handle.Friction = 0.3
- handle.BottomSurface = Enum.SurfaceType.Weld
- local mesh_3 = Instance.new("BlockMesh", handle)
- mesh_3.Scale = Vector3.new(1, 0.75, 1)
- local decal_5 = Instance.new("Decal", handle)
- decal_5.Face = Enum.NormalId.Back
- decal_5.Texture = "http://www.roblox.com/asset/?id=41872777"
- local decal_6 = Instance.new("Decal", handle)
- decal_6.Texture = "http://www.roblox.com/asset/?id=41872766"
- local decal_7 = Instance.new("Decal", handle)
- decal_7.Face = Enum.NormalId.Top
- decal_7.Texture = "http://www.roblox.com/asset/?id=41872777"
- local decal_8 = Instance.new("Decal", handle)
- decal_8.Face = Enum.NormalId.Bottom
- decal_8.Texture = "http://www.roblox.com/asset/?id=41872777"
- local decal_9 = Instance.new("Decal", handle)
- decal_9.Face = Enum.NormalId.Right
- decal_9.Texture = "http://www.roblox.com/asset/?id=41872777"
- local decal_10 = Instance.new("Decal", handle)
- decal_10.Face = Enum.NormalId.Left
- decal_10.Texture = "http://www.roblox.com/asset/?id=41872824"
- local slash = Instance.new("Sound", handle)
- slash.Pitch = 2
- slash.Name = "Slash"
- slash.Volume = 1
- slash.SoundId = "http://roblox.com/asset/?id=10209850"
- slash.PlayOnRemove = true
- local hit = Instance.new("Sound", handle)
- hit.Pitch = 4
- hit.Name = "Hit"
- hit.Volume = 1
- hit.SoundId = "http://roblox.com/asset/?id=10209596"
- hit.PlayOnRemove = true
- local pewpew = Instance.new("Sound", handle)
- pewpew.Name = "PewPew"
- pewpew.Volume = 1
- pewpew.SoundId = "http://www.roblox.com/asset/?id=13775480"
- local knifepart = Instance.new("Part", combatknife)
- knifepart.FormFactor = Enum.FormFactor.Custom
- knifepart.LeftSurface = Enum.SurfaceType.Weld
- knifepart.TopSurface = Enum.SurfaceType.Weld
- knifepart.Anchored = false
- knifepart.Size = Vector3.new(0.2, 0.2, 0.2)
- knifepart.Name = "KnifePart"
- knifepart.FrontSurface = Enum.SurfaceType.Weld
- knifepart.Locked = true
- knifepart.CFrame = CFrame.new(-4.645, 2.08, 2.705)* CFrame.Angles(-8.9700122771319e-005, 0.2698617875576, -3.1415920257568)
- knifepart.RightSurface = Enum.SurfaceType.Weld
- knifepart.BackSurface = Enum.SurfaceType.Weld
- knifepart.BrickColor = BrickColor.new("Dark grey metallic")
- knifepart.Friction = 0.3
- knifepart.BottomSurface = Enum.SurfaceType.Weld
- local mesh_4 = Instance.new("SpecialMesh", knifepart)
- mesh_4.Scale = Vector3.new(0.25, 1, 1)
- mesh_4.MeshType = Enum.MeshType.Wedge
- local decal_11 = Instance.new("Decal", knifepart)
- decal_11.Face = Enum.NormalId.Top
- decal_11.Texture = "http://www.roblox.com/asset/?id=41872824"
- local decal_12 = Instance.new("Decal", knifepart)
- decal_12.Face = Enum.NormalId.Bottom
- decal_12.Texture = "http://www.roblox.com/asset/?id=41872824"
- local decal_13 = Instance.new("Decal", knifepart)
- decal_13.Face = Enum.NormalId.Back
- decal_13.Texture = "http://www.roblox.com/asset/?id=41872824"
- local decal_14 = Instance.new("Decal", knifepart)
- decal_14.Texture = "http://www.roblox.com/asset/?id=41872824"
- local decal_15 = Instance.new("Decal", knifepart)
- decal_15.Face = Enum.NormalId.Right
- decal_15.Texture = "http://www.roblox.com/asset/?id=41872824"
- local decal_16 = Instance.new("Decal", knifepart)
- decal_16.Face = Enum.NormalId.Left
- decal_16.Texture = "http://www.roblox.com/asset/?id=41872824"
- local knifepart_2 = Instance.new("Part", combatknife)
- knifepart_2.FormFactor = Enum.FormFactor.Custom
- knifepart_2.LeftSurface = Enum.SurfaceType.Weld
- knifepart_2.TopSurface = Enum.SurfaceType.Weld
- knifepart_2.Anchored = false
- knifepart_2.Size = Vector3.new(0.2, 0.2, 0.2)
- knifepart_2.Name = "KnifePart"
- knifepart_2.FrontSurface = Enum.SurfaceType.Weld
- knifepart_2.Locked = true
- knifepart_2.CFrame = CFrame.new(-4.547, 2.045, 3.102)* CFrame.Angles(3.1415030956268, -0.2698617875576, -7.4260981364205e-007)
- knifepart_2.RightSurface = Enum.SurfaceType.Weld
- knifepart_2.BackSurface = Enum.SurfaceType.Weld
- knifepart_2.BrickColor = BrickColor.new("Dark grey metallic")
- knifepart_2.Friction = 0.3
- knifepart_2.BottomSurface = Enum.SurfaceType.Weld
- local mesh_5 = Instance.new("SpecialMesh", knifepart_2)
- mesh_5.Scale = Vector3.new(0.25, 1, 1)
- mesh_5.MeshType = Enum.MeshType.Wedge
- local decal_17 = Instance.new("Decal", knifepart_2)
- decal_17.Face = Enum.NormalId.Top
- decal_17.Texture = "http://www.roblox.com/asset/?id=41872824"
- local decal_18 = Instance.new("Decal", knifepart_2)
- decal_18.Face = Enum.NormalId.Bottom
- decal_18.Texture = "http://www.roblox.com/asset/?id=41872824"
- local decal_19 = Instance.new("Decal", knifepart_2)
- decal_19.Face = Enum.NormalId.Back
- decal_19.Texture = "http://www.roblox.com/asset/?id=41872824"
- local decal_20 = Instance.new("Decal", knifepart_2)
- decal_20.Texture = "http://www.roblox.com/asset/?id=41872824"
- local decal_21 = Instance.new("Decal", knifepart_2)
- decal_21.Face = Enum.NormalId.Right
- decal_21.Texture = "http://www.roblox.com/asset/?id=41872824"
- local decal_22 = Instance.new("Decal", knifepart_2)
- decal_22.Face = Enum.NormalId.Left
- decal_22.Texture = "http://www.roblox.com/asset/?id=41872824"
- local humanoid = Instance.new("Humanoid", combatknife)
- humanoid.Health = 0
- local prev
- local parts = combatknife:GetChildren()
- for i = 1,#parts do
- if (parts[i].className == "Part") then
- if (prev ~= nil)then
- local weld = Instance.new("Weld")
- weld.Part0 = prev
- weld.Part1 = parts[i]
- weld.C0 = prev.CFrame:inverse()
- weld.C1 = parts[i].CFrame:inverse()
- weld.Parent = prev
- end
- prev = parts[i]
- end
- end
- local Tool = combatknife;
- enabled = true
- function onButton1Down(mouse)
- if not enabled then
- return
- end
- enabled = false
- mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
- wait(.05)
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- enabled = true
- end
- function onEquippedLocal(mouse)
- if mouse == nil then
- print("Mouse not found")
- return
- end
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- mouse.Button1Down:connect(function() onButton1Down(mouse) end)
- local g = combatknife:GetChildren()
- for i=1, #g do
- if g[i].className == "Part" then
- g[i].CanCollide = false
- end
- end
- end
- Tool.Equipped:connect(onEquippedLocal)
- function onUnequippedLocal(mouse)
- local g = combatknife:GetChildren()
- for i=1, #g do
- if g[i].className == "Part" then
- g[i].CanCollide = true
- end
- end
- end
- Tool.Unequipped:connect(onUnequippedLocal)
- r = game:service("RunService")
- local damage = 75
- local slash_damage = 75
- sword = combatknife.Handle
- Tool = combatknife
- 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)
- edge.Touched:connect(function(hit)
- local h = hit.Parent:FindFirstChild('Humanoid')
- if h then
- h.Health = h.Health - 5
- end
- end)
- function blow(hit)
- local humanoid = hit.Parent:findFirstChild("Zombie")
- 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
- if sword.Hit.IsPaused == true then
- sword.Hit:play()
- end
- 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, -1, 0)
- Tool.GripPos = Vector3.new(0,0,0)
- Tool.GripRight = Vector3.new(-1, 0, 0.001)
- Tool.GripUp = Vector3.new(0.001, 0, 1)
- 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)
- sword.Slash:play()
- 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, -1, 0)
- Tool.GripPos = Vector3.new(0,0,0)
- Tool.GripRight = Vector3.new(0, 0, 1)
- Tool.GripUp = Vector3.new(1, 0, 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()
- print("LOL")
- end
- combatknife.Activated:connect(onActivated)
- combatknife.Equipped:connect(onEquipped)
- for i,part in pairs(Tool:GetChildren()) do
- if part.Name == "Edge" then
- connection = part.Touched:connect(blow)
- end
- end
- function onEquipped()
- p= combatknife:GetChildren()
- for i= 1, #p do
- if p[i].className == "Part" or p[i].className == "TrussPart" or p[i].className == "WedgePart" then
- p[i].Locked = true
- end
- end
- end
- combatknife.Equipped:connect(onEquipped)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement