Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Tool0 = Instance.new("Tool")
- Part1 = Instance.new("Part")
- SpecialMesh2 = Instance.new("SpecialMesh")
- Sound3 = Instance.new("Sound")
- Sound4 = Instance.new("Sound")
- Sound5 = Instance.new("Sound")
- Tool0.Name = "Blood Sword"
- Tool0.Parent = owner['Backpack']
- Tool0.TextureId = "rbxasset://Textures/Sword128.png"
- Tool0.Grip = CFrame.new(0, 0, -1.5, 0, 0, 1, 1, 0, 0, 0, 1, 0)
- Tool0.GripForward = Vector3.new(-1, -0, -0)
- Tool0.GripPos = Vector3.new(0, 0, -1.5)
- Tool0.GripRight = Vector3.new(0, 1, 0)
- Tool0.GripUp = Vector3.new(0, 0, 1)
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.CFrame = CFrame.new(-3.43658304, 5.1203289, 3.84549809, 0.0910440385, -0.881099463, 0.464084357, 0.537011683, 0.435894847, 0.722229123, -0.838648558, 0.183463722, 0.512845576)
- Part1.Color = Color3.new(0.462745, 0, 0)
- Part1.Size = Vector3.new(1, 0.800000012, 4)
- Part1.Locked = true
- Part1.Material = Enum.Material.SmoothPlastic
- SpecialMesh2.Parent = Part1
- SpecialMesh2.MeshId = "rbxasset://fonts/sword.mesh"
- SpecialMesh2.MeshType = Enum.MeshType.FileMesh
- Sound3.Name = "SwordSlash"
- Sound3.Parent = Part1
- Sound3.SoundId = "http://www.roblox.com/asset/?id=12222216"
- Sound3.Volume = 0.69999998807907
- Sound4.Name = "SwordLunge"
- Sound4.Parent = Part1
- Sound4.SoundId = "http://www.roblox.com/asset/?id=12222208"
- Sound4.Volume = 0.60000002384186
- Sound5.Name = "Unsheath"
- Sound5.Parent = Part1
- Sound5.SoundId = "http://www.roblox.com/asset/?id=12222225"
- Sound5.Volume = 1
- Tool = Tool0
- Handle = Tool:WaitForChild("Handle")
- function Create(ty)
- return function(data)
- local obj = Instance.new(ty)
- for k, v in pairs(data) do
- if type(k) == 'number' then
- v.Parent = obj
- else
- obj[k] = v
- end
- end
- return obj
- end
- end
- local BaseUrl = "rbxassetid://"
- Players = game:GetService("Players")
- Debris = game:GetService("Debris")
- RunService = game:GetService("RunService")
- local SlashDamage = 100
- local LungeDamage = 100
- local Damage = SlashDamage
- --For R15 avatars
- Animations = {
- R15Slash = 522635514,
- R15Lunge = 522638767
- }
- Grips = {
- Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
- Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
- }
- Sounds = {
- Slash = Handle:WaitForChild("SwordSlash"),
- Lunge = Handle:WaitForChild("SwordLunge"),
- Unsheath = Handle:WaitForChild("Unsheath")
- }
- ToolEquipped = false
- Tool.Grip = Grips.Up
- Tool.Enabled = true
- function TagHumanoid(humanoid, player)
- local Creator_Tag = Instance.new("ObjectValue")
- Creator_Tag.Name = "creator"
- Creator_Tag.Value = player
- Debris:AddItem(Creator_Tag, 2)
- Creator_Tag.Parent = humanoid
- end
- function UntagHumanoid(humanoid)
- for i, v in pairs(humanoid:GetChildren()) do
- if v:IsA("ObjectValue") and v.Name == "creator" then
- v:Destroy()
- end
- end
- end
- local junk = Instance.new("Folder",script)
- local junk2 = Instance.new("Folder",script)
- local chars = {}
- local sfx = {
- cry_pain = {4534200393,4534197713,4534199297,4534199744,4534197529,4534197880,4534198897},
- stabs = {6330987744,6330987902,6330988021,6330988145},
- }
- function raycast(Pos, Dir, Max, Ignore)
- local rayparams = RaycastParams.new()
- rayparams.FilterType = Enum.RaycastFilterType.Blacklist
- rayparams.FilterDescendantsInstances = Ignore
- rayparams.IgnoreWater = true
- return workspace:Raycast(Pos, Dir * (Max or 999.999), rayparams)
- end
- function raycast2(Pos, Dir, Max, whitelist)
- local rayparams = RaycastParams.new()
- rayparams.FilterType = Enum.RaycastFilterType.Whitelist
- rayparams.FilterDescendantsInstances = whitelist
- rayparams.IgnoreWater = true
- return workspace:Raycast(Pos, Dir * (Max or 999.999), rayparams)
- end
- coroutine.wrap(function()
- for i,v in pairs(workspace:GetChildren()) do
- if v:FindFirstChildOfClass("Humanoid") then
- table.insert(chars,1,v)
- end
- end
- workspace.ChildAdded:Connect(function(v)
- game:GetService("RunService").Heartbeat:Wait()
- if v:FindFirstChildOfClass("Humanoid") then
- table.insert(chars,1,v)
- end
- end)
- end)()
- function cast_blood(targchar,obj,lastpos,dir,ignore,count)
- ignore = ignore or {targchar,chars,junk}
- count = count or 1
- if count >= 3 then return end
- local blood = nil
- local s = lastpos
- local dist = math.clamp((obj.Position-lastpos).Magnitude,7,1000)
- dir = dir.Unit
- local result = raycast(s,dir,dist,ignore)
- if result and not blood then
- local ob,pos,norm = result.Instance,result.Position,result.Normal
- local char = ob:FindFirstAncestorOfClass('Model')
- local hum = nil
- if char then
- hum = char:FindFirstChildOfClass('Humanoid')
- end
- if not hum and 1 > ob.Transparency then else
- --table.insert(ignore,1,ob)
- --cast_blood(targchar,obj,dir,ignore,count)
- return
- end
- local m = 1+math.random()
- if ob.Name == 'blood' then
- blood = ob
- local newsize = blood.Size+Vector3.new(0.1*m,0,0.1*m)
- if newsize.X >= 10 then
- newsize = Vector3.new(10,0.1,10)
- end
- local rs = newsize.X
- newsize = Vector3.new(rs,0.1,rs)
- blood.Size = newsize
- return true
- end
- blood = Instance.new("Part")
- blood.Name = 'blood'
- blood.Color = Color3.fromRGB(117,0,0)
- blood.Material = Enum.Material.Glass
- blood.Transparency = 1
- blood.Anchored = true
- blood.CanCollide = false
- blood.CastShadow = false
- blood.Size = Vector3.new()
- blood.CFrame = CFrame.new(pos,pos+norm)*CFrame.Angles(math.rad(90),0,0)
- blood.Parent = junk2
- local newsize = Vector3.new(1*m,0.1,1*m)
- local rs = newsize.X --restrict_size(newsize,ob.Size,norm)
- newsize = Vector3.new(rs,0.1,rs)
- game:GetService("TweenService"):Create(blood,TweenInfo.new(0.5),{
- Transparency = 0,
- Size = newsize,
- }):Play()
- local hval = Instance.new("ObjectValue")
- hval.Name = 'hit'
- hval.Value = ob
- hval.Parent = blood
- local mesh = Instance.new("SpecialMesh")
- mesh.MeshType = Enum.MeshType.Sphere
- mesh.Parent = blood
- if _G['lfx'] then
- game:GetService("Debris"):AddItem(blood,5)
- else
- game:GetService("Debris"):AddItem(blood,10)
- end
- return true
- end
- end
- local bdata = {}
- function createblood(obj,dur,dir,start)
- coroutine.wrap(function()
- if obj.Name ~= 'HumanoidRootPart' then else return end
- local targchar = obj.Parent
- local targhum = targchar:FindFirstChildOfClass('Humanoid')
- if not bdata[obj] then
- bdata[obj] = {dur,dir}
- else
- bdata[obj][1] += dur
- bdata[obj][2] = dir
- return
- end
- local st = os.clock()
- while true do
- if bdata[obj][1] >= os.clock()-st and obj and obj.Parent and targchar and targchar.Parent then else
- break
- end
- coroutine.wrap(function()
- local drop = Instance.new("Part")
- drop.Anchored = false
- drop.CanCollide = false
- drop.Massless = true
- drop.CastShadow = false
- drop.CFrame = obj.CFrame--*start
- drop.Size = Vector3.new(0.2,0.2,0.2)
- drop.Shape = Enum.PartType.Ball
- drop.Color = Color3.new(0.454902, 0, 0)
- drop.Material = Enum.Material.Glass
- drop.Velocity = dir*10+Vector3.new(math.random()*2-1,math.random()*2-1,math.random()*2-1)*10
- local att1,att2 = Instance.new("Attachment",drop),Instance.new("Attachment",drop)
- att1.Position = Vector3.new(0,drop.Size.Y/2,0)
- att2.Position = Vector3.new(0,-drop.Size.Y/2,0)
- local trail = Instance.new("Trail")
- trail.Attachment0 = att1
- trail.Attachment1 = att2
- trail.Transparency = NumberSequence.new(0,1)
- trail.MinLength = 0.1
- trail.Lifetime = 0.2
- trail.Color = ColorSequence.new(Color3.new(0.454902, 0, 0),Color3.new(0.454902, 0, 0))
- trail.Parent = drop
- local lastpos = drop.Position
- drop.Parent = junk
- game:GetService("Debris"):AddItem(drop,5)
- local hit = false
- while not hit and drop and drop.Parent and obj do
- local st = os.clock()
- repeat
- game:GetService("RunService").Stepped:Wait()
- until os.clock()-st >= 0.2
- local d = drop.Velocity
- hit = cast_blood(targchar,obj,lastpos,d)
- lastpos = drop.Position
- end
- if drop then
- drop:Destroy()
- end
- end)()
- wait(0.1)
- end
- end)()
- end
- function check_knock(char,hum)
- if 15 > hum.Health and hum.Health > 0 then
- --ragdoll(char,false)
- end
- end
- function is_god(char)
- local ff = char:FindFirstChildOfClass("ForceField")
- local hum = char:FindFirstChildOfClass("Humanoid")
- if ff then
- return true
- elseif hum and hum.MaxHealth >= 1/0 then
- return true
- end
- end
- function bleed(obj,dur,dir,start,can_hurt,visible)
- if visible == nil then
- visible = true
- end
- local char = obj.Parent
- local hum = char:FindFirstChildOfClass('Humanoid')
- if visible then
- createblood(obj,dur,dir,start)
- end
- if can_hurt then
- local groan = Instance.new("Sound")
- groan.SoundId = 'rbxassetid://' .. sfx.cry_pain[math.random(1,#sfx.cry_pain)]
- groan.Volume = 0.5
- groan.Parent = obj
- groan:Play()
- game:GetService("Debris"):AddItem(groan,1)
- coroutine.wrap(function()
- local st = os.clock()
- while dur >= os.clock()-st do
- if hum and not is_god(char) then
- local dmg = 1
- if 0 >= hum.Health-dmg then
- --ragdoll(char,true)
- end
- hum:TakeDamage(dmg)
- check_knock(char,hum)
- end
- wait(0.1)
- end
- end)()
- end
- end
- function raycastdepth(targchar, org, dir, ignore, attempt)
- ignore = ignore or {}
- attempt = attempt or 1
- local parts = {}
- for i,v in pairs(targchar:GetChildren()) do
- if v:IsA("BasePart") and (v.Name == 'Head' or v.Name == 'HumanoidRootPart') then
- table.insert(parts,v)
- end
- end
- --[[
- for i,v in pairs(targchar:GetChildren()) do
- if v:IsA("BasePart") and v.Name ~= 'Head' and v.Name ~= 'HumanoidRootPart' then
- table.insert(parts,v)
- end
- end
- local result = raycast2(org, dir, nil, {unpack(parts)})
- ]]
- local chars2 = chars
- table.remove(chars2,table.find(chars2,targchar))
- local result = raycast(org, dir, nil, {chars2,parts,junk})
- local hit,pos,norm
- if result then
- hit,pos,norm = result.Instance,result.Position,result.Normal
- end
- if result and hit.Parent == targchar then
- local diagonalLength = hit.Size.Magnitude
- local reverseLook = -dir.Unit
- local dir2 = reverseLook*diagonalLength
- local org2 = pos - dir2
- local result = raycast2(org2, dir2, nil,{hit})
- local hit2,pos2,norm2
- local depth = 0
- if result then
- hit2,pos2,norm2 = result.Instance,result.Position,result.Normal
- depth = (pos2-pos).Magnitude
- end
- return hit,pos,norm,hit2,pos2,norm2,depth
- else
- if attempt >= 2 or not result then
- return hit,pos,norm
- else
- raycastdepth(targchar, org, dir, {hit,unpack(ignore)}, attempt+1)
- end
- end
- end
- function blood_tissue(targchar,org,dir,lpart,lpart2)
- local hit,pos,norm,hit2,pos2,norm2,depth = raycastdepth(targchar,org,dir.Unit)
- local par = junk --targchar:FindFirstChild("Torso") or targchar:FindFirstChild("HumanoidRootPart")
- if hit and hit2 and par then else return end
- local w = 0.1
- local lp,lp2
- pcall(function()
- local clot = Instance.new("Part")
- clot.BrickColor = BrickColor.new("Maroon")
- clot.Material = Enum.Material.SmoothPlastic
- clot.Massless = true
- clot.Anchored = false
- clot.CanCollide = false
- clot.Shape = Enum.PartType.Ball
- clot.Size = Vector3.new(w,0.1,w)
- clot.CFrame = CFrame.new(pos,pos+norm)*CFrame.Angles(math.rad(90),0,0)
- clot.Parent = par
- local weld = Instance.new("Weld")
- weld.Part0 = hit
- weld.Part1 = clot
- weld.C0 = weld.Part0.CFrame:Inverse()
- weld.C1 = weld.Part1.CFrame:Inverse()
- weld.Parent = clot
- if lpart then
- local rod = Instance.new("RodConstraint")
- rod.Attachment0 = Instance.new("Attachment",lpart)
- rod.Attachment1 = Instance.new("Attachment",clot)
- rod.Visible = true
- rod.Thickness = w
- rod.Color = clot.BrickColor
- rod.Parent = clot
- end
- lp = clot
- game:GetService("Debris"):AddItem(clot,10)
- end)
- pcall(function()
- local clot = Instance.new("Part")
- clot.BrickColor = BrickColor.new("Maroon")
- clot.Material = Enum.Material.SmoothPlastic
- clot.Massless = true
- clot.Anchored = false
- clot.CanCollide = false
- clot.Shape = Enum.PartType.Ball
- clot.Size = Vector3.new(w,0.1,w)
- clot.CFrame = CFrame.new(pos2,pos2+norm2)*CFrame.Angles(math.rad(90),0,0)
- clot.Parent = par
- local weld = Instance.new("Weld")
- weld.Part0 = hit2
- weld.Part1 = clot
- weld.C0 = weld.Part0.CFrame:Inverse()
- weld.C1 = weld.Part1.CFrame:Inverse()
- weld.Parent = clot
- if lpart2 then
- local rod = Instance.new("RodConstraint")
- rod.Attachment0 = Instance.new("Attachment",lpart2)
- rod.Attachment1 = Instance.new("Attachment",clot)
- rod.Visible = true
- rod.Thickness = w
- rod.Color = clot.BrickColor
- rod.Parent = clot
- end
- lp2 = clot
- game:GetService("Debris"):AddItem(clot,10)
- end)
- return lp,lp2
- end
- local lastattack = os.clock()
- local max_attack_time = 0.5
- function Blow(obj)
- if max_attack_time > os.clock()-lastattack then else return end
- if not obj or not obj.Parent or not CheckIfAlive() or not ToolEquipped then
- return
- end
- local RightArm = Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand")
- if not RightArm then
- return
- end
- local RightGrip = RightArm:FindFirstChild("RightGrip")
- if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then
- return
- end
- local targchar = obj.Parent
- if targchar then
- local targtorso = targchar:FindFirstChild("Torso") or targchar:FindFirstChild("HumanoidRootPart")
- local targhum = targchar:FindFirstChildOfClass("Humanoid")
- local targplr = game:GetService("Players"):GetPlayerFromCharacter(targchar)
- if targhum and targhum.Health > 0 then
- local cval = targhum:FindFirstChild("blood sword" .. plr.Name)
- if cval then return end
- cval = Instance.new("StringValue")
- cval.Name = "blood sword" .. plr.Name
- cval.Parent = targhum
- game:GetService("Debris"):AddItem(cval,0.4)
- UntagHumanoid(targhum)
- TagHumanoid(targhum,plr)
- targhum:TakeDamage(Damage)
- local s = Instance.new("Sound")
- s.SoundId = 'rbxassetid://' .. sfx.stabs[math.random(#sfx.stabs)]
- s.PlaybackSpeed = math.random(90,110)/100
- s.Volume = 0.5
- s.Parent = obj
- s:Play()
- game:GetService("Debris"):AddItem(s,2)
- local start = targtorso.CFrame:ToObjectSpace(Handle.CFrame)
- local dir = (targtorso.Position-torso.Position)
- coroutine.wrap(function()
- local n = 0.1
- local lpart,lpart2
- for i = 0,max_attack_time,n do
- local pos = Handle.Position
- local lp,lp2 = blood_tissue(targchar,pos,(obj.Position-pos),lpart,lpart2)
- if lp then
- lpart = lp
- end
- if lp2 then
- lpart2 = lp2
- end
- wait(n)
- end
- end)()
- coroutine.wrap(function()
- bleed(obj,Damage/targhum.MaxHealth*15,dir,start,false,true)
- end)()
- end
- end
- end
- function Attack()
- Damage = SlashDamage
- Sounds.Slash:Play()
- if Humanoid then
- if Humanoid.RigType == Enum.HumanoidRigType.R6 then
- local Anim = Instance.new("StringValue")
- Anim.Name = "toolanim"
- Anim.Value = "Slash"
- Anim.Parent = Tool
- elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
- local Anim = Tool:FindFirstChild("R15Slash")
- if Anim then
- local Track = Humanoid:LoadAnimation(Anim)
- Track:Play(0)
- end
- end
- end
- end
- function Lunge()
- Damage = LungeDamage
- Sounds.Lunge:Play()
- if Humanoid then
- if Humanoid.RigType == Enum.HumanoidRigType.R6 then
- local Anim = Instance.new("StringValue")
- Anim.Name = "toolanim"
- Anim.Value = "Lunge"
- Anim.Parent = Tool
- elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
- local Anim = Tool:FindFirstChild("R15Lunge")
- if Anim then
- local Track = Humanoid:LoadAnimation(Anim)
- Track:Play(0)
- end
- end
- end
- wait(0.2)
- Tool.Grip = Grips.Out
- wait(0.6)
- Tool.Grip = Grips.Up
- Damage = SlashDamage
- end
- Tool.Enabled = true
- function Activated()
- if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
- return
- end
- Tool.Enabled = false
- local Tick = os.clock()
- if (0.2 > Tick-lastattack) then
- Lunge()
- else
- Attack()
- end
- lastattack = os.clock()
- --wait(0.5)
- Damage = SlashDamage
- local SlashAnim = (Tool:FindFirstChild("R15Slash") or Create("Animation"){
- Name = "R15Slash",
- AnimationId = BaseUrl .. Animations.R15Slash,
- Parent = Tool
- })
- local LungeAnim = (Tool:FindFirstChild("R15Lunge") or Create("Animation"){
- Name = "R15Lunge",
- AnimationId = BaseUrl .. Animations.R15Lunge,
- Parent = Tool
- })
- Tool.Enabled = true
- end
- function CheckIfAlive()
- return (((plr and plr.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and torso and torso.Parent) and true) or false)
- end
- function Equipped()
- Character = Tool.Parent
- plr = game:GetService("Players"):GetPlayerFromCharacter(Character)
- Humanoid = Character:FindFirstChildOfClass("Humanoid")
- torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("HumanoidRootPart")
- if not CheckIfAlive() then
- return
- end
- ToolEquipped = true
- Sounds.Unsheath:Play()
- end
- function Unequipped()
- Tool.Grip = Grips.Up
- ToolEquipped = false
- end
- Tool.Activated:Connect(Activated)
- Tool.Equipped:Connect(Equipped)
- Tool.Unequipped:Connect(Unequipped)
- Connection = Handle.Touched:Connect(Blow)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement