Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------- wfmp
- r = game:service("RunService")
- damageTable = {
- ["TerryMichaelBrunk"] = {slashdamage=3,lungedamage=4};
- ["kidzrock4"] = {slashdamage=1,lungedamage=3}
- }
- local damage = 0
- local slashdamage = 2 --The punch is 3 because its is normal attack
- local lungedamage = 4 --Its by 5 when it gets stronger
- sword = script.Parent.Handle
- Tool = script.Parent
- local SlashSound = Instance.new("Sound")
- SlashSound.SoundId = "e9eefbccb5894696187ac8739894df5e"
- SlashSound.Parent = sword
- SlashSound.Volume = .7
- local LungeSound = Instance.new("Sound")
- LungeSound.SoundId = "f624b7d32dced04bdf156f3de5e2032"
- LungeSound.Parent = sword
- LungeSound.Volume = .6
- local UnsheathSound = script.Parent.Handle.Sound
- UnsheathSound.SoundId = "http://www.sound-effect.com/sounds1/human/fight/punch2.wav"
- UnsheathSound.Parent = sword
- UnsheathSound.Volume = 1
- 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.Health = humanoid.Health - 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()
- if damageTable[script.Parent:FindFirstAncestor("Model").Name] then
- damage = damageTable[script.Parent:FindFirstAncestor("Model").Name].slashdamage
- else
- damage = slashdamage
- end
- SlashSound:play()
- local anim = Instance.new("StringValue")
- anim.Name = "toolanim"
- anim.Value = "Slash"
- anim.Parent = Tool
- damage = 0
- end
- function lunge()
- if damageTable[script.Parent:FindFirstAncestor("Model").Name] then
- damage = damageTable[script.Parent:FindFirstAncestor("Model").Name].lungedamage
- else
- damage = lungedamage
- end
- LungeSound:play()
- local anim = Instance.new("StringValue")
- anim.Name = "toolanim"
- anim.Value = "Lunge"
- anim.Parent = Tool
- force = Instance.new("BodyVelocity")
- force.velocity = Vector3.new(0,0,0) --Tool.Parent.Torso.CFrame.lookVector * 80
- force.maxForce = Vector3.new(0,0,0)
- force.Parent = Tool.Parent.Torso
- wait(.25)
- swordOut()
- wait(.25)
- force.Parent = nil
- wait(.5)
- swordUp()
- damage = 0
- end
- function swordUp()
- Tool.Handle.CanCollide = false
- Tool.GripForward = Vector3.new(-1,0,0)
- Tool.GripRight = Vector3.new(0,1,0)
- Tool.GripUp = Vector3.new(0,0,1)
- Tool.Handle.CanCollide = true
- end
- function swordOut()
- Tool.Handle.CanCollide = false
- Tool.GripForward = Vector3.new(0,0,1)
- Tool.GripRight = Vector3.new(0,-1,0)
- Tool.GripUp = Vector3.new(-1,0,0)
- Tool.Handle.CanCollide = true
- 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()
- if (t - last_attack < 2000) then
- lunge()
- else
- attack()
- end
- last_attack = t
- --wait(.5)
- Tool.Enabled = true
- end
- function onEquipped()
- UnsheathSound:play()
- end
- script.Parent.Activated:connect(onActivated)
- script.Parent.Equipped:connect(onEquipped)
- connection = sword.Touched:connect(blow)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement