Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local studspermeters = 20
- local fatal_vel = studspermeters*15
- local terminal_vel = studspermeters*16
- local fallstates = {
- Enum.HumanoidStateType.Freefall,
- Enum.HumanoidStateType.FallingDown,
- Enum.HumanoidStateType.Flying,
- Enum.HumanoidStateType.Jumping,
- }
- local bleeding = {}
- local falling = {}
- local ragdolled = {}
- local gores1 = {3739335394,3737268126,3929462189,3739335007}
- local gores2 = {3847883680,3847884467,3847885772,3929462677}
- local gores3 = {4953187368,4953187704}
- local pg = {1489922915,1489934368}
- local stuns = {
- 5169623605,
- 5169624072,
- 5169626214,
- 5169624072,
- 5169623821,
- 5169626595
- }
- local impacts = {
- 3848124871,
- 3848125583,
- 3848126035,
- 3929466751
- }
- if not _G['ignore pain engine'] then
- _G['ignore pain engine'] = {}
- end
- function check_fatal(hum,dmg)
- if 0 >= (hum.Health - dmg) then
- return true
- end
- return false
- end
- function check_godded(hum,lasthp)
- if lasthp then
- if lasthp > hum.Health then
- return true
- end
- elseif hum.MaxHealth >= math.huge or hum.MaxHealth >= 1/0 then
- return true
- elseif hum.Parent:FindFirstChildOfClass("ForceField") then
- return true
- end
- end
- function is_enabled(plr)
- if _G['ignore pain engine'][plr.UserId] then
- return true
- elseif _G['ignore pain engine'][plr.UserId] == nil then
- return true
- else
- return false
- end
- end
- function toggle_enable(plr,bool)
- _G['ignore pain engine'][plr.UserId] = bool
- end
- local junk = Instance.new("Folder",script)
- function bleed2(plr,frick,targhum,can_hurt,t,splat,dir)
- coroutine.resume(coroutine.create(function()
- if frick and targhum then else return end
- local rig = targhum.RigType
- local limbs = {'Head','Left Arm','Right Arm','Left Leg','Right Leg','RightUpperLeg','LeftUpperLeg','RightUpperArm','LeftUpperArm','RightLowerLeg','LeftLowerLeg','RightLowerArm','LeftLowerArm','RightFoot','LeftFoot','RightHand','LeftHand'}
- local interval_bleed = 0.1
- if not bleeding[frick] or 0 >= bleeding[frick] then
- bleeding[frick] = 0
- bleeding[frick] = bleeding[frick] + t
- elseif bleeding[frick] > 0 then
- bleeding[frick] = bleeding[frick] + t
- return
- else
- return
- end
- while bleeding[frick] > 0 do
- if (not frick or not frick.Parent or not frick.Parent.Parent or not targhum or not targhum.Parent) then
- break
- end
- local max_limbs = 0
- local current_limbs = 0
- local gone_limbs = 0
- local targchar = targhum.Parent
- if rig == Enum.HumanoidRigType.R6 then
- max_limbs = 5
- elseif rig == Enum.HumanoidRigType.R15 then
- max_limbs = 13
- end
- for i,v in pairs(targchar:GetChildren()) do
- local found = false
- for i,n in pairs(limbs) do if n == v.Name then found = true; end; end;
- if found and not v:FindFirstChild("Dismembered") then
- current_limbs = current_limbs + 1
- end
- end
- gone_limbs = (max_limbs-current_limbs)
- if targhum and can_hurt then
- local bdmg = 0.3
- local multi = 3
- if 0 >= gone_limbs then
- gone_limbs = 1
- else
- gone_limbs = gone_limbs*multi
- end
- if 0 >= (targhum.Health - bdmg*gone_limbs) then
- targhum.BreakJointsOnDeath = false
- --[[
- pcall(function()
- kill(plr,targchar,dir,5)
- end)
- ]]
- end
- targhum:TakeDamage(bdmg*gone_limbs)
- end
- local vel = (dir*0.5)+Vector3.new(math.random(-5, 5)/40,math.random(-5, 5)/30,math.random(-5, 5)/40)
- local thing = Instance.new('Part')
- thing.Name = "blood_drop"
- thing.Size = Vector3.new(0.1,0.1,0.1)
- thing.CFrame = frick.CFrame*CFrame.new(0,frick.Size.Y/2,0)
- if splat then
- thing.Transparency = 0
- elseif not splat then
- thing.Transparency = 1
- end
- thing.Color = Color3.fromRGB(75, 0, 0)
- thing.Material = Enum.Material.SmoothPlastic
- thing.CanCollide = false
- thing.Velocity = vel
- thing.Parent = junk
- thing:SetNetworkOwner(plr)
- local mesh = Instance.new('SpecialMesh')
- mesh.MeshType = Enum.MeshType.Sphere
- mesh.Parent = thing
- game:GetService("Debris"):AddItem(thing,10)
- local att1,att2 = Instance.new("Attachment"),Instance.new("Attachment")
- att1.Parent = thing
- att1.Position = Vector3.new(0,-(thing.Size.Y/2),0)
- att2.Parent = thing
- att2.Position = Vector3.new(0,(thing.Size.Y/2),0)
- if splat then
- local trail_drop = Instance.new("Trail")
- trail_drop.Parent = thing
- trail_drop.Attachment0 = att1
- trail_drop.Attachment1 = att2
- trail_drop.Color = ColorSequence.new(Color3.new(0.5, 0, 0),Color3.new(0.7, 0, 0))
- trail_drop.FaceCamera = true
- trail_drop.LightInfluence = 1
- trail_drop.WidthScale = NumberSequence.new(1,0)
- trail_drop.Transparency = NumberSequence.new(0,1)
- trail_drop.Lifetime = 0.1
- trail_drop.MinLength = 0
- end
- local rawrxd = Instance.new('BodyForce')
- rawrxd.Parent = thing
- rawrxd.Force = vel
- game:GetService("Debris"):AddItem(rawrxd,0.01)
- thing.Touched:connect(function(tou)
- if tou and tou.Parent and not tou:IsDescendantOf(targchar) and not tou:IsDescendantOf(junk) and not tou.Parent:FindFirstChildOfClass("Humanoid") and not tou.Parent.Parent:FindFirstChildOfClass("Humanoid") and not tou.Parent:IsA("Accessory") and tou.Name ~= 'Handle' and tou.Parent.Name ~= 'Handle' and not tou.Parent:IsA("Tool") and not string.match(tou.Name:lower(),'blood_drop') and not string.match(tou.Name:lower(),'bullet') and not string.match(tou.Name:lower(),'bone') and not string.match(tou.Name:lower(),'gun mag') and not string.match(tou.Name:lower(),'limb') then
- local pos = Vector3.new(thing.Position.X,(tou.Position.Y+(tou.Size.Y/2))+(0.02/2),thing.Position.Z)
- local Point1 = pos-Vector3.new(0.01,0.01,0.01)
- local Point2 = pos+Vector3.new(0.01,0.01,0.01)
- local Region = Region3.new(Point1,Point2)
- for _,Part in pairs(game.Workspace:FindPartsInRegion3(Region,nil,math.huge)) do
- if Part.Name == "blood" then
- tou = Part
- end
- end
- thing:Destroy()
- if tou.Name == "blood" then
- local reee = tou.CFrame
- if tou.Transparency > -0.2 then
- tou.Transparency = tou.Transparency - 0.1
- end
- local s = 0.025
- local smax = 0.1
- if tou.Color.R > 0 then
- local nc = tou.Color.R*1.012
- if nc > 1 then
- nc = 1
- end
- tou.Color = Color3.new(nc, 0, 0)
- end
- s = smax*math.clamp(t/10,0,1)
- if tou.Size.X < 5 then
- tou.Size = tou.Size+Vector3.new(s*4,0,s*4)
- elseif tou.Size.X < 7.5 then
- tou.Size = tou.Size+Vector3.new(s*3,0,s*3)
- elseif tou.Size.X < 10 then
- tou.Size = tou.Size+Vector3.new(s*2,0,s*2)
- end
- tou.CFrame = reee
- local tween = game:GetService("TweenService"):Create(tou,TweenInfo.new(4),{Transparency = 1})
- tween:Play()
- tween.Completed:Connect(function()
- if tou.Transparency >= 0.9 then
- tou:Destroy()
- end
- end)
- local splash = Instance.new("Sound",tou)
- splash.SoundId = 'rbxassetid://5157825454' --685857471
- splash.Volume = 0.025
- splash.PlayOnRemove = true
- splash:Destroy()
- elseif tou.CanCollide == true then
- local bloodsplat = Instance.new('Part')
- local s = math.random(5,10)/10
- if gone_limbs >= 1 then
- bloodsplat.Size = Vector3.new(s*gone_limbs,0.2,s*gone_limbs)
- else
- bloodsplat.Size = Vector3.new(s,0.2,s)
- end
- bloodsplat.Name = "blood"
- bloodsplat.Anchored = true
- bloodsplat.CanCollide = false
- bloodsplat.Material = Enum.Material.Glass
- bloodsplat.Color = Color3.fromRGB(75, 0, 0)
- bloodsplat.Transparency = -0.2
- bloodsplat.Parent = junk
- bloodsplat.CFrame = CFrame.new(pos)
- local mesh = Instance.new('SpecialMesh')
- mesh.MeshType = Enum.MeshType.Sphere
- mesh.Parent = bloodsplat
- local tween = game:GetService("TweenService"):Create(bloodsplat,TweenInfo.new(4),{Transparency = 1})
- tween:Play()
- tween.Completed:Connect(function()
- if bloodsplat.Transparency >= 0.9 then
- bloodsplat:Destroy()
- end
- end)
- local splash = Instance.new("Sound",bloodsplat)
- splash.SoundId = 'rbxassetid://5157825454'
- splash.Volume = 0.025
- splash.PlayOnRemove = true
- splash:Destroy()
- end
- end
- end)
- bleeding[frick] = bleeding[frick] - interval_bleed
- wait(interval_bleed)
- end
- end))
- end
- function blood_splat(obj)
- local ParticleEmitter1 = Instance.new("ParticleEmitter")
- local ParticleEmitter2 = Instance.new("ParticleEmitter")
- local ParticleEmitter3 = Instance.new("ParticleEmitter")
- ParticleEmitter1.Name = "Blood3"
- ParticleEmitter1.Parent = obj
- ParticleEmitter1.Speed = NumberRange.new(3, 7)
- ParticleEmitter1.Rotation = NumberRange.new(-360, 360)
- ParticleEmitter1.Color = ColorSequence.new(Color3.new(0.486275, 0, 0),Color3.new(0.258824, 0, 0))
- ParticleEmitter1.Enabled = false
- ParticleEmitter1.LightEmission = 0.20000000298023
- ParticleEmitter1.LightInfluence = 1
- ParticleEmitter1.Texture = "rbxassetid://241779220"
- ParticleEmitter1.Transparency = NumberSequence.new(1,0.48750001192093,0.75625002384186,1)
- ParticleEmitter1.ZOffset = 0.5
- ParticleEmitter1.Size = NumberSequence.new(0,2.8749995231628)
- ParticleEmitter1.Acceleration = Vector3.new(0, -5, 0)
- ParticleEmitter1.EmissionDirection = Enum.NormalId.Front
- ParticleEmitter1.Lifetime = NumberRange.new(0.40000000596046, 1)
- ParticleEmitter1.Rate = 3000
- ParticleEmitter1.RotSpeed = NumberRange.new(-40, 270)
- ParticleEmitter1.SpreadAngle = Vector2.new(360, 360)
- ParticleEmitter1.VelocitySpread = 360
- ParticleEmitter2.Name = "Blood"
- ParticleEmitter2.Parent = obj
- ParticleEmitter2.Speed = NumberRange.new(5, 10)
- ParticleEmitter2.Rotation = NumberRange.new(-360, 360)
- ParticleEmitter2.Color = ColorSequence.new(Color3.new(0.666667, 0, 0),Color3.new(0.423529, 0, 0))
- ParticleEmitter2.Enabled = false
- ParticleEmitter2.LightEmission = 0.40000000596046
- ParticleEmitter2.LightInfluence = 1
- ParticleEmitter2.Texture = "rbxassetid://73547327"
- ParticleEmitter2.Transparency = NumberSequence.new(0.10000000149012,0.14375001192093,0.49374997615814,1)
- ParticleEmitter2.Size = NumberSequence.new(0,2.8749995231628)
- ParticleEmitter2.Acceleration = Vector3.new(0, -5, 0)
- ParticleEmitter2.EmissionDirection = Enum.NormalId.Front
- ParticleEmitter2.Lifetime = NumberRange.new(0.30000001192093, 0.5)
- ParticleEmitter2.Rate = 10000000
- ParticleEmitter2.RotSpeed = NumberRange.new(-40, 270)
- ParticleEmitter2.SpreadAngle = Vector2.new(360, 360)
- ParticleEmitter2.VelocitySpread = 360
- ParticleEmitter3.Name = "Blood2"
- ParticleEmitter3.Parent = obj
- ParticleEmitter3.Speed = NumberRange.new(5, 14)
- ParticleEmitter3.Color = ColorSequence.new(Color3.new(0.45098, 0, 0),Color3.new(0.45098, 0, 0))
- ParticleEmitter3.Enabled = false
- ParticleEmitter3.LightEmission = 0.20000000298023
- ParticleEmitter3.LightInfluence = 1
- ParticleEmitter3.Texture = "http://www.roblox.com/asset/?id=134531274"
- ParticleEmitter3.Transparency = NumberSequence.new(0.30000001192093,0.30000001192093)
- ParticleEmitter3.ZOffset = 1
- ParticleEmitter3.Size = NumberSequence.new(0.12499988079071,0)
- ParticleEmitter3.Acceleration = Vector3.new(0, -20, 0)
- ParticleEmitter3.EmissionDirection = Enum.NormalId.Front
- ParticleEmitter3.Lifetime = NumberRange.new(0.5, 1.5)
- ParticleEmitter3.Rate = 100000
- ParticleEmitter3.SpreadAngle = Vector2.new(360, 360)
- ParticleEmitter3.VelocitySpread = 360
- --
- ParticleEmitter1:Emit(20)
- ParticleEmitter2:Emit(20)
- ParticleEmitter3:Emit(20)
- --
- game:GetService("Debris"):AddItem(ParticleEmitter1,2)
- game:GetService("Debris"):AddItem(ParticleEmitter2,2)
- game:GetService("Debris"):AddItem(ParticleEmitter3,2)
- --
- end
- function limb_collide(obj,mode,d)
- if (obj:IsA("UnionOperation") or obj:IsA("BasePart")) and not obj:FindFirstChild('limb') then else return end
- local exists = pcall(game:GetService("PhysicsService").GetCollisionGroupId, game:GetService("PhysicsService"), 'Limb Collide')
- if not exists then
- game:GetService("PhysicsService"):CreateCollisionGroup('Limb Collide')
- end
- game:GetService("PhysicsService"):CollisionGroupSetCollidable('Limb Collide','Limb Collide',false)
- --
- local t = {}
- --
- local cb = Instance.new("Part")
- cb.Name = 'limb'
- cb.Transparency = 1
- cb.CanCollide = true
- cb.Anchored = false
- cb.CFrame = obj.CFrame
- cb.Size = obj.Size*0.9
- cb.Massless = true
- cb.Locked = true
- game:GetService("PhysicsService"):SetPartCollisionGroup(cb,'Limb Collide')
- game:GetService("PhysicsService"):SetPartCollisionGroup(obj,'Limb Collide')
- local weld = Instance.new("Weld")
- weld.Part0 = cb
- weld.Part1 = obj
- weld.Parent = cb
- --obj.Massless = true
- obj.Anchored = false
- if mode or obj:FindFirstChild("Dismembered") then
- cb.Parent = junk -- .Parent
- else
- cb.Parent = junk
- table.insert(t,1,cb)
- end
- if d then
- game:GetService("Debris"):AddItem(cb,d)
- end
- --
- if not string.match(obj.Name:lower(),'torso') and not string.match(obj.Name:lower(),'rootpart') and not string.match(obj.Name:lower(),'head') then
- local lv = Vector3.new() -- Vector3.new(cb.Size.X,0,cb.Size.Z)
- local cb2 = Instance.new("Part")
- cb2.Name = 'limb'
- cb2.Transparency = 1
- cb2.CanCollide = true
- cb2.Anchored = false
- cb2.CFrame = obj.CFrame
- cb2.Size = lv
- cb2.Massless = true
- cb2.Locked = true
- --game:GetService("PhysicsService"):SetPartCollisionGroup(cb2,'Limb Collide')
- local weld2 = Instance.new("Weld")
- weld2.Part0 = cb
- weld2.Part1 = cb2
- weld2.C1 = CFrame.new(0,(cb.Size.Y/2),0)
- weld2.Parent = cb2
- if mode or obj:FindFirstChild("Dismembered") then
- cb2.Parent = junk -- .Parent
- else
- cb2.Parent = junk
- table.insert(t,1,cb2)
- end
- if d then
- game:GetService("Debris"):AddItem(cb2,d)
- end
- end
- --
- return t
- end
- function recurse(root,callback,i)
- i= i or 0
- for _,v in pairs(root:GetChildren()) do
- i = i + 1
- callback(i,v)
- if #v:GetChildren() > 0 then
- i = recurse(v,callback,i)
- end
- end
- return i
- end
- function ragdollJoint(character, part0, part1, attachmentName, className, properties)
- attachmentName = attachmentName.."RigAttachment"
- local constraint = Instance.new(className.."Constraint")
- constraint.Attachment0 = part0:FindFirstChild(attachmentName)
- constraint.Attachment1 = part1:FindFirstChild(attachmentName)
- constraint.Name = "RagdollConstraint"..part1.Name
- for _,propertyData in next,properties or {} do
- constraint[propertyData[1]] = propertyData[2]
- end
- constraint.Parent = character
- end
- function getAttachment0(character, attachmentName)
- for _,child in next,character:GetChildren() do
- local attachment = child:FindFirstChild(attachmentName)
- if attachment then
- return attachment
- end
- end
- end
- function ragdoll(targchar,kill,remove)
- if targchar then else return end
- local targplr
- pcall(function()
- targplr = game:GetService("Players"):GetPlayerFromCharacter(targchar)
- end)
- local pc = targchar
- local targhum = pc:FindFirstChildOfClass("Humanoid")
- local js,js2 = {},{}
- local lc = {}
- targhum.PlatformStand = true
- --if kill then
- local old_pc
- if remove then
- pc.Archivable = true
- old_pc = pc
- pc = pc:Clone()
- end
- for i,v in pairs(pc:GetDescendants()) do
- if v.Name ~= 'HumanoidRootPart' and v.Name ~= 'Torso' and v:IsA("BasePart") then
- if remove or not kill then
- local t = limb_collide(v,false,10)
- table.insert(lc,1,t)
- end
- end
- if kill then
- if v:IsA("ParticleEmitter") then
- v.Enabled = false
- end
- if v:IsA("SelectionBox") or v:IsA("BodyVelocity") or v:IsA("BodyPosition") or v:IsA("BodyAngularVelocity") or v:IsA("BodyForce") or v:IsA("BodyGyro") or v:IsA("BodyThrust") or v:IsA("BodyMover") then
- if v:IsA("BodyVelocity") then
- game:GetService("Debris"):AddItem(v,0.15)
- else
- v:Destroy()
- end
- end
- if (v:IsA("Script") and v.Name == 'Health') or (v:IsA("LocalScript") and v.Name == 'Animate') then
- v:Destroy()
- end
- if v:IsA("Humanoid") then
- v.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
- v.PlatformStand = true
- end
- end
- end
- if remove then
- for i,v in pairs(old_pc:GetDescendants()) do
- if v:IsA("BasePart") or v:IsA("UnionOperation") or v:IsA("ForceField") or v:IsA("Accessory") or v:IsA("Decal") or v:IsA("Texture") or v:IsA("SurfaceGui") then
- v:destroy()
- end
- if v:IsA("Humanoid") then
- v.BreakJointsOnDeath = true
- v.Health = 0
- v.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
- v.PlatformStand = true
- end
- end
- pc.Parent = junk
- game:GetService("Debris"):AddItem(pc,10)
- end
- --end
- --if kill and targhum:FindFirstChild("Ragdolled") then return; end;
- coroutine.resume(coroutine.create(function()
- if targplr then
- for i,v in pairs(pc:GetChildren()) do
- if v:IsA("BasePart") then
- --v.Massless = true
- if v:CanSetNetworkOwnership() then
- v:SetNetworkOwner(targplr)
- end
- end
- end
- end
- end))
- local kb = 15
- local root = pc:FindFirstChild("HumanoidRootPart")
- local targtorso = pc:FindFirstChild("Torso") or pc:FindFirstChild("UpperTorso") or pc:FindFirstChild("Head") or pc:FindFirstChild("HumanoidRootPart")
- if targtorso then else return end
- local dir = targtorso.CFrame.lookVector*-1
- local bv = Instance.new("BodyVelocity")
- bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- bv.Velocity = --[[dir*kb+]]Vector3.new(0,kb,0)
- bv.Parent = targtorso
- game:GetService("Debris"):AddItem(bv,0.1)
- if kill then
- local ragval = Instance.new("ObjectValue")
- ragval.Name = 'Ragdolled'
- ragval.Parent = targhum
- end
- coroutine.resume(coroutine.create(function()
- if (targhum.RigType == Enum.HumanoidRigType.R6 or (targhum.RigType == Enum.HumanoidRigType.R15 and not kill)) then
- for _,m in pairs(pc:GetChildren()) do
- for _,v in pairs(m:GetChildren()) do
- if (v:IsA("Snap") --[[or v:IsA('Weld')]] or v:IsA("BallSocketConstraint")) and kill then
- v:Destroy()
- end
- if (v:IsA('Motor6D') or v:IsA('Motor') or v:IsA("Weld")) and (v.Parent:IsA("BasePart") or v.Parent:IsA("UnionOperation")) then
- if not kill then
- table.insert(js2,1,{obj = v,par = v.Parent})
- end
- local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
- a0.CFrame = v.C0
- a1.CFrame = v.C1
- a0.Parent = v.Part0
- a1.Parent = v.Part1
- local b = Instance.new("BallSocketConstraint")
- b.Attachment0 = a0
- b.Attachment1 = a1
- b.Parent = v.Part0
- v.Parent = nil
- table.insert(js,1,b)
- end
- end
- end
- elseif targhum.RigType == Enum.HumanoidRigType.R15 and kill then
- local character = targchar
- recurse(character, function(_,v)
- if v:IsA("Attachment") then
- v.Axis = Vector3.new(0, 1, 0)
- v.SecondaryAxis = Vector3.new(0, 0, 1)
- v.Rotation = Vector3.new(0, 0, 0)
- end
- end)
- --Re-attach hats
- for _,child in next,character:GetChildren() do
- if child:IsA("Accoutrement") then
- --Loop through all parts instead of only checking for one to be forwards-compatible in the event
- --ROBLOX implements multi-part accessories
- for _,part in next,child:GetChildren() do
- if part:IsA("BasePart") then
- local attachment1 = part:FindFirstChildOfClass("Attachment")
- local attachment0 = getAttachment0(character, attachment1.Name)
- if attachment0 and attachment1 then
- --Shouldn't use constraints for this, but have to because of a ROBLOX idiosyncrasy where
- --joints connecting a character are perpetually deleted while the character is dead
- local constraint = Instance.new("HingeConstraint")
- constraint.Attachment0 = attachment0
- constraint.Attachment1 = attachment1
- constraint.LimitsEnabled = true
- constraint.UpperAngle = 0 --Simulate weld by making it difficult for constraint to move
- constraint.LowerAngle = 0
- constraint.Parent = character
- end
- end
- end
- end
- end
- ragdollJoint(character, character.LowerTorso, character.UpperTorso, "Waist", "BallSocket", {
- {"LimitsEnabled",true};
- {"UpperAngle",5};
- })
- ragdollJoint(character, character.UpperTorso, character.Head, "Neck", "BallSocket", {
- {"LimitsEnabled",true};
- {"UpperAngle",15};
- })
- local handProperties = {
- {"LimitsEnabled", true};
- {"UpperAngle",0};
- {"LowerAngle",0};
- }
- ragdollJoint(character, character.LeftLowerArm, character.LeftHand, "LeftWrist", "Hinge", handProperties)
- ragdollJoint(character, character.RightLowerArm, character.RightHand, "RightWrist", "Hinge", handProperties)
- local shinProperties = {
- {"LimitsEnabled", true};
- {"UpperAngle", 0};
- {"LowerAngle", -75};
- }
- ragdollJoint(character, character.LeftUpperLeg, character.LeftLowerLeg, "LeftKnee", "Hinge", shinProperties)
- ragdollJoint(character, character.RightUpperLeg, character.RightLowerLeg, "RightKnee", "Hinge", shinProperties)
- local footProperties = {
- {"LimitsEnabled", true};
- {"UpperAngle", 15};
- {"LowerAngle", -45};
- }
- ragdollJoint(character, character.LeftLowerLeg, character.LeftFoot, "LeftAnkle", "Hinge", footProperties)
- ragdollJoint(character, character.RightLowerLeg, character.RightFoot, "RightAnkle", "Hinge", footProperties)
- --TODO fix ability for socket to turn backwards whenn ConeConstraints are shipped
- ragdollJoint(character, character.UpperTorso, character.LeftUpperArm, "LeftShoulder", "BallSocket")
- ragdollJoint(character, character.LeftUpperArm, character.LeftLowerArm, "LeftElbow", "BallSocket")
- ragdollJoint(character, character.UpperTorso, character.RightUpperArm, "RightShoulder", "BallSocket")
- ragdollJoint(character, character.RightUpperArm, character.RightLowerArm, "RightElbow", "BallSocket")
- ragdollJoint(character, character.LowerTorso, character.LeftUpperLeg, "LeftHip", "BallSocket")
- ragdollJoint(character, character.LowerTorso, character.RightUpperLeg, "RightHip", "BallSocket")
- end
- end))
- if root then
- root.CanCollide = false
- end
- local c
- if root then
- c = root.Touched:Connect(function(obj)
- if obj and not obj:IsDescendantOf(junk) and (root.Velocity.Magnitude >= 3) then
- local impact = Instance.new("Sound",root)
- impact.Name = 'impact'
- impact.SoundId = 'rbxassetid://' .. impacts[math.random(1,#impacts)]
- impact.Volume = 0.1
- impact.PlayOnRemove = true
- impact:Destroy()
- end
- end)
- end
- local function restore()
- if c then
- c:Disconnect()
- end
- if root then
- root.CFrame = root.CFrame*CFrame.new(0,4,0)
- end
- for i,v in pairs(js) do
- v:Destroy()
- end
- for i,v in pairs(lc) do
- for i,v in pairs(v) do
- v:Destroy()
- end
- end
- if targhum then
- targhum.PlatformStand = false
- end
- for i,v in pairs(js2) do
- v.obj.Parent = v.par
- end
- if root then
- root.CanCollide = true
- end
- end
- return restore
- end
- function connectfall(plr,torso,hum)
- local dmg = 0
- local saved_vel = 0
- while falling[hum] do
- if not falling[hum] then
- break
- end
- saved_vel = torso.Velocity.Magnitude
- wait(0)
- end
- if saved_vel >= 75 then
- dmg = 100*(saved_vel/fatal_vel)
- if saved_vel >= fatal_vel*1.2 and torso and plr.Character then
- local p = Instance.new("Part")
- p.CanCollide = false
- p.Anchored = true
- p.Size = Vector3.new()
- p.Position = torso.Position
- p.Transparency = 1
- p.Parent = junk
- local impact = Instance.new("Sound",p)
- impact.Name = 'impact'
- impact.SoundId = 'rbxassetid://' .. impacts[math.random(1,#impacts)]
- impact.Volume = 0.1
- impact.PlayOnRemove = true
- impact:Destroy()
- local explode2 = Instance.new("Sound",p)
- explode2.Name = 'expode'
- explode2.SoundId = 'rbxassetid://' .. impacts[math.random(1,#impacts)]
- explode2.Volume = 0.15
- explode2.PlayOnRemove = true
- explode2:Destroy()
- local exp_gore = Instance.new("Sound")
- exp_gore.SoundId = "rbxassetid://" .. gores3[math.random(1,#gores3)]
- exp_gore.Volume = 4
- exp_gore.Parent = p
- exp_gore:Play()
- local pe = Instance.new("ParticleEmitter")
- pe.Speed = NumberRange.new(15, 15)
- pe.Color = ColorSequence.new({
- ColorSequenceKeypoint.new(0,Color3.new(1, 0, 0)),
- ColorSequenceKeypoint.new(0.5,Color3.new(1, 0.33333, 0)),
- ColorSequenceKeypoint.new(1,Color3.new(1, 1, 1)),
- })
- pe.LightEmission = 0.80000001192093
- pe.Texture = "rbxassetid://162359401"
- pe.Size = NumberSequence.new({
- NumberSequenceKeypoint.new(0,0),
- NumberSequenceKeypoint.new(0.0264,1),
- NumberSequenceKeypoint.new(0.3,1),
- NumberSequenceKeypoint.new(0.5,1.5),
- NumberSequenceKeypoint.new(1,2),
- })
- --pe.Drag = 0.60000002384186
- pe.Transparency = NumberSequence.new({
- NumberSequenceKeypoint.new(0,0),
- NumberSequenceKeypoint.new(0.5,0),
- NumberSequenceKeypoint.new(1,1),
- })
- pe.Lifetime = NumberRange.new(1,2)
- pe.Rate = 100
- pe.SpreadAngle = Vector2.new(180, 180)
- pe.Parent = p
- pe.Enabled = false
- pe:Emit(75)
- blood_splat(p)
- for _,v in pairs(plr.Character:GetChildren()) do
- if v:IsA("BasePart") or v:IsA("UnionOperation") then
- explode_limb(plr,v,plr.Character,v.CFrame.upVector*-1,dmg)
- end
- end
- game:GetService("Debris"):AddItem(p,5)
- end
- if check_godded(hum) then
- return
- end
- if not check_fatal(hum,dmg) then
- if not torso:FindFirstChild("pain groan") then
- local groan = Instance.new("Sound")
- groan.Name = 'pain groan'
- groan.SoundId = 'rbxassetid://' .. stuns[math.random(1,#stuns)]
- groan.Volume = 1
- groan.Parent = torso
- groan.PlayOnRemove = true
- groan:Destroy()
- end
- coroutine.resume(coroutine.create(function()
- ragdolled[plr] = true
- local restore = ragdoll(torso.Parent,false)
- hum:SetStateEnabled(Enum.HumanoidStateType.Freefall,true)
- hum:SetStateEnabled(Enum.HumanoidStateType.Landed,true)
- wait(10*(saved_vel/fatal_vel))
- if plr and ragdolled[plr] then
- ragdolled[plr] = false
- end
- if restore then
- restore()
- end
- end))
- end
- blood_splat(torso,torso.Position,Vector3.new())
- --[[
- if check_fatal(hum,dmg) then
- bleed2(plr,torso,hum,false,game:GetService("Players").RespawnTime,false,torso.CFrame.upVector*-1)
- elseif dmg >= 25 then
- bleed2(plr,torso,hum,false,3,false,torso.CFrame.upVector*-1)
- end
- ]]
- local smash_s = Instance.new("Sound")
- smash_s.Parent = torso
- smash_s.PlayOnRemove = true
- local dmg_s = Instance.new("Sound")
- dmg_s.Parent = torso
- dmg_s.PlayOnRemove = true
- if check_fatal(hum,dmg) then
- --smash_s.SoundId = 'rbxassetid://' .. gores2[math.random(1,#gores2)]
- smash_s.Volume = 0.7
- dmg_s.SoundId = 'rbxassetid://704141469'
- dmg_s.Volume = 1.5
- elseif dmg >= 50 then
- --smash_s.SoundId = 'rbxassetid://' .. gores1[math.random(1,#gores1)]
- smash_s.Volume = 0.7
- dmg_s.SoundId = 'rbxassetid://535681058'
- dmg_s.Volume = 1
- elseif dmg >= 25 then
- dmg_s.SoundId = 'rbxassetid://4057626616'
- dmg_s.Volume = 1.5
- end
- smash_s:Destroy()
- dmg_s:Destroy()
- hum:TakeDamage(dmg)
- end
- end
- function burn_up(obj,mode)
- if mode == 1 then
- local particle = obj:FindFirstChild("flame")
- local light = obj:FindFirstChild("flame light")
- local flame_sound = obj:FindFirstChild('burn up')
- local scream_sound = obj:FindFirstChild('flame scream')
- if not obj:FindFirstChild("burn up") then
- local start_flame = Instance.new("Sound")
- start_flame.SoundId = 'rbxassetid://5868574236'
- start_flame.Parent = obj
- start_flame.Volume = 2.5
- start_flame.PlayOnRemove = true
- start_flame:Destroy()
- flame_sound = Instance.new("Sound")
- flame_sound.Name = 'burn up'
- flame_sound.SoundId = 'rbxassetid://443980606'
- flame_sound.Volume = 1.5
- flame_sound.Parent = obj
- flame_sound.Looped = true
- flame_sound:Play()
- scream_sound = Instance.new("Sound")
- scream_sound.Name = 'flame scream'
- scream_sound.SoundId = 'rbxassetid://147758618'
- scream_sound.Parent = obj
- scream_sound.Looped = true
- scream_sound:Play()
- local PointLight1 = Instance.new("PointLight")
- PointLight1.Name = 'flame light'
- PointLight1.Parent = obj
- PointLight1.Color = Color3.new(1, 0.803922, 0.341176)
- PointLight1.Range = 21
- PointLight1.Brightness = 0.47499999403954
- PointLight1.Shadows = true
- light = PointLight1
- particle = Instance.new("Fire")
- particle.Name = 'flame'
- particle.Size = 10
- particle.Parent = obj
- end
- elseif mode == 2 then
- local particle = obj:FindFirstChild("flame")
- local light = obj:FindFirstChild("flame light")
- local flame_sound = obj:FindFirstChild('burn up')
- local scream_sound = obj:FindFirstChild('flame scream')
- if particle and particle.Enabled then
- particle.Enabled = false
- game:GetService("Debris"):AddItem(particle,1.5)
- end
- if light and light.Enabled then
- light.Enabled = false
- game:GetService("Debris"):AddItem(light,1)
- end
- if flame_sound then
- flame_sound:Destroy()
- end
- if scream_sound then
- scream_sound:Destroy()
- end
- end
- end
- function explode_limb(plr,obj,targchar,dir,dmg)
- local targhum = targchar:FindFirstChildOfClass("Humanoid")
- local targtorso = targchar:FindFirstChild("Torso") or targchar:FindFirstChild("UpperTorso") or targchar:FindFirstChild("HumanoidRootPart")
- if dmg > 0 and not obj:FindFirstChild('Dismembered') --[[and obj.Name ~= 'Torso' and obj.Name ~= 'HumanoidRootPart' and obj.Name ~= 'UpperTorso' and obj.Name ~= 'LowerTorso']] then else return end
- local d = 10
- local t = dmg/d
- local t2 = dmg/20/d
- bleed2(plr,targtorso,targhum,true,t,true,Vector3.new(0,-1,0).Unit)
- local gs = Instance.new("Sound")
- gs.SoundId = 'rbxassetid://206082273' -- 'rbxassetid://' .. gores2[math.random(1,#gores2)]
- gs.Volume = 0.3
- gs.PlayOnRemove = true
- gs.Parent = obj
- gs:Destroy()
- for i = 1,d do
- local p = Vector3.new(obj.Size.X/math.random(d/3,d/2),obj.Size.Y/math.random(d/3,d/2),obj.Size.Z/math.random(d/3,d/2))
- local blood_chunk = Instance.new("Part")
- blood_chunk.Size = p
- blood_chunk.CanCollide = true
- blood_chunk.Anchored = false
- if math.random(1,2) == 1 then
- blood_chunk.Color = Color3.fromRGB(math.random(90,170),0,0)
- else
- blood_chunk.Color = obj.Color
- end
- blood_chunk.Position = obj.Position+Vector3.new(math.random(-obj.Size.X*10,obj.Size.X*10)/10/2,math.random(-obj.Size.Y*10,obj.Size.Y*10)/10/2,math.random(-obj.Size.Z*10,obj.Size.Z*10)/10/2)
- blood_chunk.Material = Enum.Material.Slate
- blood_chunk.Parent = junk
- local kb = 25
- local ka = 90
- local bav = Instance.new("BodyAngularVelocity")
- bav.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
- bav.AngularVelocity = Vector3.new(math.random(-ka,ka),math.random(-ka,ka),math.random(-ka,ka))
- bav.Parent = blood_chunk
- local bv = Instance.new("BodyVelocity")
- bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- local ud = (obj.Position-blood_chunk.Position).Unit
- if kb*3 >= ud.Magnitude then
- bv.Velocity = (ud*kb)+Vector3.new(0,kb,0)
- --bleed2(plr,targtorso,targhum,true,3,false,ud)
- else
- bv.Velocity = Vector3.new(0,kb,0)
- --bleed2(plr,targtorso,targhum,true,3,false,dir)
- end
- bv.Parent = blood_chunk
- game:GetService("Debris"):AddItem(bv,0.1)
- game:GetService("Debris"):AddItem(bav,0.1)
- game:GetService("Debris"):AddItem(blood_chunk,10)
- end
- obj:Destroy()
- end
- function bind(plr,char,new)
- pcall(function()
- if char then else return end
- if is_enabled(plr) then
- local ff = Instance.new("ForceField",char)
- game:GetService("Debris"):AddItem(ff,1)
- end
- local torso = char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso") or char:FindFirstChild("HumanoidRootPart")
- local hum = char:FindFirstChildOfClass("Humanoid")
- local base = workspace:FindFirstChild('Base') or workspace:FindFirstChild('Baseplate')
- if new then
- wait(0.1)
- if base then
- torso.CFrame = base.CFrame*CFrame.new(0,base.Size.Y/2+4,0)
- else
- torso.CFrame = CFrame.new(0,base.Size.Y/2+4,0)
- end
- end
- hum.StateChanged:Connect(function(oldstate,newstate)
- local foundstate = false
- for i,v in pairs(fallstates) do
- if v == newstate then
- foundstate = true
- break
- end
- end
- if foundstate and not check_godded(hum) and is_enabled(plr) then
- if not falling[hum] then
- falling[hum] = true
- connectfall(plr,torso,hum)
- end
- else
- falling[hum] = false
- end
- end)
- local cv
- if is_enabled(plr) then
- cv = game:GetService("RunService").Stepped:Connect(function()
- if not char or not char.Parent or not torso or not torso.Parent or not hum then
- cv:Disconnect()
- end
- local vel = torso.Velocity.Magnitude
- if vel >= terminal_vel and not check_godded(hum) then
- local dmg = (vel/terminal_vel)/5
- hum:TakeDamage(dmg)
- burn_up(torso,1)
- else
- burn_up(torso,2)
- end
- end)
- end
- if hum.RigType == Enum.HumanoidRigType.R6 then
- hum.BreakJointsOnDeath = false
- hum:SetStateEnabled(Enum.HumanoidStateType.Dead,true)
- end
- local bid = 0
- local did_break = {}
- local can_break = false
- local dmged = false
- for _,limb in pairs(char:GetChildren()) do
- if (limb:IsA("BasePart") or limb:IsA("UnionOperation")) and limb.Name ~= 'HumanoidRootPart' and limb.Name ~= 'Torso' and limb.Name ~= 'UpperTorso' and limb.Name ~= 'LowerTorso' then
- limb.Touched:Connect(function(obj)
- local saved_vel = limb.Velocity.Magnitude
- local saved_vel2 = obj.Velocity.Magnitude*(obj.Mass/5)
- local dmg = (saved_vel/fatal_vel)*hum.MaxHealth
- local dmg2 = (saved_vel2/fatal_vel)*hum.MaxHealth
- if obj and obj.Parent and not obj.Parent:FindFirstChildOfClass("Humanoid") and obj.CanCollide then else
- saved_vel2 = 0
- end
- if limb and not dmged and (can_break or ragdolled[plr]) and not check_godded(hum) and (saved_vel >= fatal_vel or saved_vel2 >= fatal_vel) then
- dmged = true
- did_break[bid] = true
- local p = Instance.new("Part")
- p.CanCollide = false
- p.Anchored = true
- p.Size = Vector3.new()
- p.Position = limb.Position
- p.Transparency = 1
- p.Parent = junk
- local impact = Instance.new("Sound",p)
- impact.Name = 'impact'
- impact.SoundId = 'rbxassetid://' .. impacts[math.random(1,#impacts)]
- impact.Volume = 0.1
- impact.PlayOnRemove = true
- impact:Destroy()
- local explode2 = Instance.new("Sound",p)
- explode2.Name = 'expode'
- explode2.SoundId = 'rbxassetid://' .. impacts[math.random(1,#impacts)]
- explode2.Volume = 0.15
- explode2.PlayOnRemove = true
- explode2:Destroy()
- local exp_gore = Instance.new("Sound")
- exp_gore.SoundId = "rbxassetid://" .. gores3[math.random(1,#gores3)]
- exp_gore.Volume = 4
- exp_gore.Parent = p
- exp_gore:Play()
- local pe = Instance.new("ParticleEmitter")
- pe.Speed = NumberRange.new(15, 15)
- pe.Color = ColorSequence.new({
- ColorSequenceKeypoint.new(0,Color3.new(1, 0, 0)),
- ColorSequenceKeypoint.new(0.5,Color3.new(1, 0.33333, 0)),
- ColorSequenceKeypoint.new(1,Color3.new(1, 1, 1)),
- })
- pe.LightEmission = 0.80000001192093
- pe.Texture = "rbxassetid://162359401"
- pe.Size = NumberSequence.new({
- NumberSequenceKeypoint.new(0,0),
- NumberSequenceKeypoint.new(0.0264,1),
- NumberSequenceKeypoint.new(0.3,1),
- NumberSequenceKeypoint.new(0.5,1.5),
- NumberSequenceKeypoint.new(1,2),
- })
- --pe.Drag = 0.60000002384186
- pe.Transparency = NumberSequence.new({
- NumberSequenceKeypoint.new(0,0),
- NumberSequenceKeypoint.new(0.5,0),
- NumberSequenceKeypoint.new(1,1),
- })
- pe.Lifetime = NumberRange.new(1,2)
- pe.Rate = 100
- pe.SpreadAngle = Vector2.new(180, 180)
- pe.Parent = p
- pe.Enabled = false
- pe:Emit(75)
- blood_splat(p)
- for _,v in pairs(char:GetChildren()) do
- if v:IsA("BasePart") or v:IsA("UnionOperation") then
- explode_limb(plr,v,char,v.CFrame.upVector*-1,dmg)
- end
- end
- game:GetService("Debris"):AddItem(p,5)
- wait(0.2)
- dmged = false
- elseif limb and not dmged and (can_break or ragdolled[plr]) and (dmg >= 40 or dmg2 >= 40) then
- dmged = true
- did_break[bid] = true
- local d = dmg
- if dmg2 > dmg then
- d = dmg2
- end
- local p = Instance.new("Part")
- p.CanCollide = false
- p.Anchored = true
- p.Size = Vector3.new()
- p.Position = limb.Position
- p.Transparency = 1
- p.Parent = junk
- local impact = Instance.new("Sound",p)
- impact.Name = 'impact'
- impact.SoundId = 'rbxassetid://' .. impacts[math.random(1,#impacts)]
- impact.Volume = 0.1
- impact.PlayOnRemove = true
- impact:Destroy()
- local explode = Instance.new("Sound",p)
- explode.Name = 'expode'
- explode.SoundId = 'rbxassetid://' .. gores2[math.random(1,#gores2)]
- explode.Volume = 0.1
- explode.PlayOnRemove = true
- explode:Destroy()
- blood_splat(p)
- explode_limb(plr,limb,char,limb.CFrame.upVector*-1,d)
- game:GetService("Debris"):AddItem(p,2)
- wait(0.2)
- dmged = false
- end
- end)
- end
- end
- local curhealth = hum.Health
- hum.HealthChanged:Connect(function(newhealth)
- if check_godded(hum) then return end
- local dmg = (curhealth-newhealth)
- if curhealth > newhealth and torso --[[and hum.Health > 0]] then
- if dmg >= 30 or 0 >= newhealth then
- bid = bid + 1
- can_break = true
- wait(0.4)
- can_break = false
- end
- if dmg > 0 then
- if not did_break[bid] then
- bleed2(plr,torso,hum,false,(dmg/hum.MaxHealth)*10,false,torso.CFrame.upVector*-1)
- end
- end
- end
- curhealth = hum.Health
- end)
- hum.Died:Connect(function()
- ragdoll(char,true)
- end)
- end)
- end
- function chat(plr)
- plr.Chatted:Connect(function(msg)
- if msg:lower():sub(1,6) == 'tfall/' then
- local bool = msg:lower():sub(7)
- if bool == 'true' then
- toggle_enable(plr,true)
- elseif bool == 'false' then
- toggle_enable(plr,false)
- end
- end
- end)
- end
- for _,plr in pairs(game:GetService("Players"):GetPlayers()) do
- chat(plr)
- bind(plr,plr.Character)
- plr.CharacterAdded:Connect(function(char)
- bind(plr,char,true)
- end)
- end
- game:GetService("Players").PlayerAdded:Connect(function(plr)
- chat(plr)
- plr.CharacterAdded:Connect(function(char)
- bind(plr,char,true)
- end)
- end)
- while wait(1) do
- if not junk then
- junk = Instance.new("Folder",script)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement