Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local plr = owner
- local char = plr.Character
- local hum = char:FindFirstChildOfClass("Humanoid")
- local torso = char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso")
- local rootpart = char:FindFirstChild("HumanoidRootPart")
- local debris = game:GetService("Debris")
- local tween = game:GetService("TweenService")
- local gun = Instance.new("Tool")
- local han = Instance.new("Part")
- local SpecialMesh2 = Instance.new("SpecialMesh")
- gun.Name = "HONEY BADGER"
- gun.Parent = plr['Backpack']
- gun.Grip = CFrame.new(1.25958824, -0.0798366517, -0.00732704997, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
- han.Name = "Handle"
- han.Parent = gun
- han.CFrame = CFrame.new(-13.3080015, 1.11801457, -0.346000075, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- han.Position = Vector3.new(-13.3080015, 1.11801457, -0.346000075)
- han.Color = Color3.new(0.105882, 0.164706, 0.207843)
- han.Size = Vector3.new(5.66300011, 1.57200003, 0.252000004)
- han.BottomSurface = Enum.SurfaceType.Smooth
- han.BrickColor = BrickColor.new("Black")
- han.TopSurface = Enum.SurfaceType.Smooth
- han.brickColor = BrickColor.new("Black")
- SpecialMesh2.Parent = han
- SpecialMesh2.MeshId = "rbxassetid://1877847309"
- SpecialMesh2.Scale = Vector3.new(0.00600000005, 0.00600000005, 0.00600000005)
- SpecialMesh2.MeshType = Enum.MeshType.FileMesh
- local effect_part = Instance.new("Part")
- local smoke = Instance.new("ParticleEmitter")
- local flash = Instance.new("ParticleEmitter")
- local light = Instance.new("PointLight")
- effect_part.Name = "effect"
- effect_part.Parent = gun
- effect_part.CFrame = CFrame.new(-14.3099976, 2.64201403, -6.57999992, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- effect_part.Position = Vector3.new(-14.3099976, 2.64201403, -6.57999992)
- effect_part.Transparency = 1
- effect_part.Size = Vector3.new(0.100000001, 0.100000001, 0.100000001)
- effect_part.BottomSurface = Enum.SurfaceType.Smooth
- effect_part.CanCollide = false
- effect_part.TopSurface = Enum.SurfaceType.Smooth
- smoke.Name = "smoke"
- smoke.Parent = effect_part
- smoke.Speed = NumberRange.new(5, 7)
- smoke.Rotation = NumberRange.new(0, 360)
- smoke.Color = ColorSequence.new(Color3.new(0.27451, 0.27451, 0.27451),Color3.new(0.27451, 0.27451, 0.27451))
- smoke.Enabled = false
- smoke.LightEmission = 0.10000000149012
- smoke.Texture = "http://www.roblox.com/asset/?id=244514423"
- smoke.Transparency = NumberSequence.new(0.60000002384186,1)
- smoke.Size = NumberSequence.new(0.99999964237213,3)
- smoke.Lifetime = NumberRange.new(1.25, 1.5)
- smoke.Rate = 100
- smoke.RotSpeed = NumberRange.new(10, 10)
- smoke.SpreadAngle = Vector2.new(15, 15)
- smoke.VelocitySpread = 15
- flash.Name = "flash"
- flash.Parent = effect_part
- flash.Speed = NumberRange.new(0, 0)
- flash.Rotation = NumberRange.new(0, 90)
- flash.Color = ColorSequence.new(Color3.new(1, 1, 0.498039),Color3.new(1, 1, 0.498039))
- flash.Enabled = false
- flash.LightEmission = 1
- flash.Texture = "http://www.roblox.com/asset/?id=3419963"
- flash.Transparency = NumberSequence.new(0.75,1)
- flash.Size = NumberSequence.new(0.20000000298023,0.20000000298023)
- flash.Lifetime = NumberRange.new(0.050000000745058, 0.075000002980232)
- flash.Rate = 1000
- light.Name = "light"
- light.Parent = effect_part
- light.Color = Color3.new(1, 1, 0.498039)
- light.Enabled = false
- light.Range = 6
- light.Brightness = 10
- light.Shadows = true
- local weld = Instance.new("Weld")
- weld.Part0 = han
- weld.Part1 = effect_part
- weld.C1 = weld.C1 * CFrame.new((han.Size.X/2)+0.2,-0.5,0)
- weld.Parent = effect_part
- local cols = {BrickColor.new("Neon orange"),BrickColor.new("Really red"),BrickColor.new("Bright red"),BrickColor.new("Br. yellowish orange"),BrickColor.new("Bright yellow")}
- local taunts = {298689061,2743459732,2852509470,1018518369}
- local using = false
- local op = false
- local bulletfire = 1
- local shootwait = 0.06*bulletfire
- local max_ammo = 30
- local ammo = max_ammo
- local hitpos = nil
- local shooting = false
- local equipped = false
- local equip = Instance.new("Sound")
- equip.SoundId = 'rbxassetid://3667098999'
- equip.Volume = 0.8
- equip.Parent = han
- local shoot_s = Instance.new("Sound")
- shoot_s.Name = 'shoot'
- shoot_s.SoundId = 'rbxassetid://5541424023'
- shoot_s.Volume = 5
- shoot_s.Parent = han
- local reload_s = Instance.new("Sound")
- reload_s.SoundId = 'rbxassetid://5541740983'
- reload_s.Volume = 0.7
- reload_s.Parent = han
- local wbreak = Instance.new("Sound")
- wbreak.Parent = han
- wbreak.SoundId = "rbxassetid://627558611"
- wbreak.TimePosition = .1
- wbreak.Volume = 0.7
- function CheckIfAlive()
- local alive = false
- if plr and char and char.Parent and torso and torso.Parent and hum and hum.Parent and hum.Health > 0 then
- alive = true
- end
- return alive
- end
- function limb_collide(obj,mode)
- 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
- 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 = obj -- .Parent
- else
- cb.Parent = script
- table.insert(t,1,cb)
- 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
- 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 = obj -- .Parent
- else
- cb2.Parent = script
- table.insert(t,1,cb2)
- end
- end
- --
- return t
- end
- function Ragdoll(targchar,headless,insta,kill)
- local pc = targchar
- local targhum = pc:FindFirstChild("Humanoid")
- local js,js2 = {},{}
- for _,obj in pairs(pc:GetDescendants()) do
- if obj:IsA("BasePart") or obj:IsA("UnionOperation") then
- obj.Massless = true
- obj.Locked = true
- end
- end
- if kill == true then
- pc.Archivable = true
- local old_pc = pc
- pc = pc:Clone()
- for i,v in pairs(pc:GetDescendants()) do
- limb_collide(v,true)
- 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.BreakJointsOnDeath = false
- v.Health = 0
- v.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
- v.PlatformStand = true
- end
- end
- 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 = workspace
- game:GetService("Debris"):AddItem(pc,30)
- end
- --if kill and targhum:FindFirstChild("Ragdolled") then return; end;
- if pc ~= nil then
- local hum = pc:FindFirstChild'Humanoid'
- local LArm = pc:FindFirstChild'Left Arm'
- local RArm = pc:FindFirstChild'Right Arm'
- local LLeg = pc:FindFirstChild'Left Leg'
- local RLeg = pc:FindFirstChild'Right Leg'
- local torso = pc:FindFirstChild'Torso'
- local head = pc:FindFirstChild'Head'
- local LUA = pc:FindFirstChild'LeftUpperArm'
- local LLA = pc:FindFirstChild'LeftLowerArm'
- local LH = pc:FindFirstChild'LeftHand'
- local RUA = pc:FindFirstChild'RightUpperArm'
- local RLA = pc:FindFirstChild'RightLowerArm'
- local RH = pc:FindFirstChild'RightHand'
- local LUL = pc:FindFirstChild'LeftUpperLeg'
- local LLL = pc:FindFirstChild'LeftLowerLeg'
- local LF = pc:FindFirstChild'LeftFoot'
- local RUL = pc:FindFirstChild'RightUpperLeg'
- local RLL = pc:FindFirstChild'RightLowerLeg'
- local RF = pc:FindFirstChild'RightFoot'
- local UT = pc:FindFirstChild'UpperTorso'
- local LT = pc:FindFirstChild'LowerTorso'
- if hum and LArm and RArm and LLeg and RLeg and head then
- hum.BreakJointsOnDeath = false
- if insta then
- if hum.RigType==Enum.HumanoidRigType.R6 then
- for _,v in pairs(torso:GetDescendants()) do
- if (v:IsA('Motor6D') or v:IsA('Motor') or v:IsA('Weld') or v:IsA("BallSocketConstraint")) and (not string.match(v.Name:lower(),'root')) then
- if not kill then
- table.insert(js2,1,{obj = v,par = v.Parent})
- v.Parent = nil
- elseif kill then
- v:Destroy()
- end
- end
- end
- local vis = false
- local vis2 = false
- if LArm and not LArm:FindFirstChild('Dismembered') then
- local at1 = Instance.new("Attachment")
- at1.Parent = torso
- at1.Visible = vis
- at1.Orientation = torso.Orientation + Vector3.new(0,180,0)
- at1.Position = Vector3.new(-1,1,0)
- local at1p2 = Instance.new("Attachment")
- at1p2.Parent = LArm
- at1p2.Visible = vis
- at1p2.Orientation = LArm.Orientation + Vector3.new(0,180,0)
- at1p2.Position = Vector3.new(.5,1,0)
- local bis = Instance.new("BallSocketConstraint")
- bis.Parent = LArm
- bis.Attachment0 = at1
- bis.Attachment1 = at1p2
- bis.LimitsEnabled = true
- bis.UpperAngle = 15
- bis.Visible = vis2
- bis.TwistLimitsEnabled = true
- bis.UpperAngle = -45
- bis.TwistLowerAngle = -45
- table.insert(js,1,bis)
- end
- if RArm and not RArm:FindFirstChild('Dismembered') then
- local at2 = Instance.new("Attachment")
- at2.Parent = torso
- at2.Visible = vis
- at2.Orientation = torso.Orientation + Vector3.new(0,0,0)
- at2.Position = Vector3.new(1,1,0)
- local at2p2 = Instance.new("Attachment")
- at2p2.Parent = RArm
- at2p2.Visible = vis
- at2p2.Orientation = RArm.Orientation + Vector3.new(0,0,0)
- at2p2.Position = Vector3.new(-.5,1,0)
- local bis2 = Instance.new("BallSocketConstraint")
- bis2.Parent = RArm
- bis2.Attachment0 = at2
- bis2.Attachment1 = at2p2
- bis2.LimitsEnabled = true
- bis2.UpperAngle = 15
- bis2.Visible = vis2
- bis2.TwistLimitsEnabled = true
- bis2.UpperAngle = -45
- bis2.TwistLowerAngle = -45
- table.insert(js,1,bis2)
- end
- if RLeg and not RLeg:FindFirstChild('Dismembered') then
- local at3 = Instance.new("Attachment")
- at3.Parent = torso
- at3.Visible = vis
- at3.Orientation = torso.Orientation + Vector3.new(90,0,-90)
- at3.Position = Vector3.new(.5,-1,0)
- local at3p2 = Instance.new("Attachment")
- at3p2.Parent = RLeg
- at3p2.Visible = vis
- at3p2.Orientation = RLeg.Orientation + Vector3.new(90,0,-90)
- at3p2.Position = Vector3.new(0,1,0)
- local bis3 = Instance.new("BallSocketConstraint")
- bis3.Parent = RLeg
- bis3.Attachment0 = at3
- bis3.Attachment1 = at3p2
- bis3.LimitsEnabled = true
- bis3.UpperAngle = 180-15
- bis3.Visible = vis2
- table.insert(js,1,bis3)
- end
- if LLeg and not LLeg:FindFirstChild('Dismembered') then
- local at4 = Instance.new("Attachment")
- at4.Parent = torso
- at4.Visible = vis
- at4.Orientation = torso.Orientation + Vector3.new(90,0,-90)
- at4.Position = Vector3.new(-.5,-1,0)
- local at4p2 = Instance.new("Attachment")
- at4p2.Parent = LLeg
- at4p2.Visible = vis
- at4p2.Orientation = LLeg.Orientation + Vector3.new(90,0,-90)
- at4p2.Position = Vector3.new(0,1,0)
- local bis4 = Instance.new("BallSocketConstraint")
- bis4.Parent = LLeg
- bis4.Attachment0 = at4
- bis4.Attachment1 = at4p2
- bis4.LimitsEnabled = true
- bis4.UpperAngle = 180-15
- bis4.Visible = vis2
- table.insert(js,1,bis4)
- end
- if head and not headless and not head:FindFirstChild('Dismembered') then
- local at5 = Instance.new("Attachment")
- at5.Parent = torso
- at5.Visible = vis
- at5.Orientation = torso.Orientation + Vector3.new(180,90,0)
- at5.Position = Vector3.new(0,1,0)
- local at5p2 = Instance.new("Attachment")
- at5p2.Parent = head
- at5p2.Visible = vis
- at5p2.Orientation = head.Orientation + Vector3.new(180,90,0)
- at5p2.Position = Vector3.new(0,-.5,0)
- local bis5 = Instance.new("BallSocketConstraint")
- bis5.Parent = head
- bis5.Attachment0 = at5p2
- bis5.Attachment1 = at5
- bis5.LimitsEnabled = true
- bis5.UpperAngle = 75
- bis5.Visible = vis2
- bis5.TwistLimitsEnabled = true
- bis5.UpperAngle = -45
- bis5.TwistLowerAngle = -45
- table.insert(js,1,bis5)
- else
- --head:BreakJoints()
- end
- end
- else
- hum.Died:Connect(function()
- if hum.RigType==Enum.HumanoidRigType.R6 then
- for _,v in pairs(torso:GetDescendants()) do
- if (v:IsA('Motor6D') or v:IsA('Motor') or v:IsA('Weld') or v:IsA("BallSocketConstraint")) and (not string.match(v.Name:lower(),'root')) then
- if not kill then
- table.insert(js2,1,{obj = v,par = v.Parent})
- v.Parent = nil
- elseif kill then
- v:Destroy()
- end
- end
- end
- local vis = false
- local vis2 = false
- if LArm and not LArm:FindFirstChild('Dismembered') then
- local at1 = Instance.new("Attachment")
- at1.Parent = torso
- at1.Visible = vis
- at1.Orientation = torso.Orientation + Vector3.new(0,180,0)
- at1.Position = Vector3.new(-1,1,0)
- local at1p2 = Instance.new("Attachment")
- at1p2.Parent = LArm
- at1p2.Visible = vis
- at1p2.Orientation = LArm.Orientation + Vector3.new(0,180,0)
- at1p2.Position = Vector3.new(.5,1,0)
- local bis = Instance.new("BallSocketConstraint")
- bis.Parent = LArm
- bis.Attachment0 = at1
- bis.Attachment1 = at1p2
- bis.LimitsEnabled = true
- bis.UpperAngle = 15
- bis.Visible = vis2
- bis.TwistLimitsEnabled = true
- bis.UpperAngle = -45
- bis.TwistLowerAngle = -45
- table.insert(js,1,bis)
- end
- if RArm and not RArm:FindFirstChild('Dismembered') then
- local at2 = Instance.new("Attachment")
- at2.Parent = torso
- at2.Visible = vis
- at2.Orientation = torso.Orientation + Vector3.new(0,0,0)
- at2.Position = Vector3.new(1,1,0)
- local at2p2 = Instance.new("Attachment")
- at2p2.Parent = RArm
- at2p2.Visible = vis
- at2p2.Orientation = RArm.Orientation + Vector3.new(0,0,0)
- at2p2.Position = Vector3.new(-.5,1,0)
- local bis2 = Instance.new("BallSocketConstraint")
- bis2.Parent = RArm
- bis2.Attachment0 = at2
- bis2.Attachment1 = at2p2
- bis2.LimitsEnabled = true
- bis2.UpperAngle = 15
- bis2.Visible = vis2
- bis2.TwistLimitsEnabled = true
- bis2.UpperAngle = -45
- bis2.TwistLowerAngle = -45
- table.insert(js,1,bis2)
- end
- if RLeg and not RLeg:FindFirstChild('Dismembered') then
- local at3 = Instance.new("Attachment")
- at3.Parent = torso
- at3.Visible = vis
- at3.Orientation = torso.Orientation + Vector3.new(90,0,-90)
- at3.Position = Vector3.new(.5,-1,0)
- local at3p2 = Instance.new("Attachment")
- at3p2.Parent = RLeg
- at3p2.Visible = vis
- at3p2.Orientation = RLeg.Orientation + Vector3.new(90,0,-90)
- at3p2.Position = Vector3.new(0,1,0)
- local bis3 = Instance.new("BallSocketConstraint")
- bis3.Parent = RLeg
- bis3.Attachment0 = at3
- bis3.Attachment1 = at3p2
- bis3.LimitsEnabled = true
- bis3.UpperAngle = 180-15
- bis3.Visible = vis2
- table.insert(js,1,bis3)
- end
- if LLeg and not LLeg:FindFirstChild('Dismembered') then
- local at4 = Instance.new("Attachment")
- at4.Parent = torso
- at4.Visible = vis
- at4.Orientation = torso.Orientation + Vector3.new(90,0,-90)
- at4.Position = Vector3.new(-.5,-1,0)
- local at4p2 = Instance.new("Attachment")
- at4p2.Parent = LLeg
- at4p2.Visible = vis
- at4p2.Orientation = LLeg.Orientation + Vector3.new(90,0,-90)
- at4p2.Position = Vector3.new(0,1,0)
- local bis4 = Instance.new("BallSocketConstraint")
- bis4.Parent = LLeg
- bis4.Attachment0 = at4
- bis4.Attachment1 = at4p2
- bis4.LimitsEnabled = true
- bis4.UpperAngle = 180-15
- bis4.Visible = vis2
- table.insert(js,1,bis4)
- end
- if head and not headless and not head:FindFirstChild('Dismembered') then
- local at5 = Instance.new("Attachment")
- at5.Parent = torso
- at5.Visible = vis
- at5.Orientation = torso.Orientation + Vector3.new(180,90,0)
- at5.Position = Vector3.new(0,1,0)
- local at5p2 = Instance.new("Attachment")
- at5p2.Parent = head
- at5p2.Visible = vis
- at5p2.Orientation = head.Orientation + Vector3.new(180,90,0)
- at5p2.Position = Vector3.new(0,-.5,0)
- local bis5 = Instance.new("BallSocketConstraint")
- bis5.Parent = head
- bis5.Attachment0 = at5p2
- bis5.Attachment1 = at5
- bis5.LimitsEnabled = true
- bis5.UpperAngle = 75
- bis5.Visible = vis2
- bis5.TwistLimitsEnabled = true
- bis5.UpperAngle = -45
- bis5.TwistLowerAngle = -45
- table.insert(js,1,bis5)
- else
- --head:BreakJoints()
- end
- end
- end)
- end
- elseif head and hum then
- hum.BreakJointsOnDeath = false
- if insta then
- if hum.RigType==Enum.HumanoidRigType.R15 then
- for _,v in pairs(pc:GetDescendants()) do
- if (v:IsA('Motor6D') or v:IsA('Motor') or v:IsA("BallSocketConstraint")) and (not string.match(v.Name:lower(),'root')) then
- if not kill then
- table.insert(js2,1,{obj = v,par = v.Parent})
- v.Parent = nil
- elseif kill then
- v:Destroy()
- end
- end
- end
- local vis = false
- local vis2 = false
- if LF and not LF:FindFirstChild('Dismembered') then
- local bsc1 = Instance.new("BallSocketConstraint",LF)
- bsc1.Attachment0 = LF.LeftAnkleRigAttachment
- bsc1.Attachment1 = LLL.LeftAnkleRigAttachment
- table.insert(js,1,bsc1)
- end
- if LLL and not LLL:FindFirstChild('Dismembered') then
- local bsc2 = Instance.new("BallSocketConstraint",LLL)
- bsc2.Attachment0 = LLL.LeftKneeRigAttachment
- bsc2.Attachment1 = LUL.LeftKneeRigAttachment
- table.insert(js,1,bsc2)
- end
- if LUL and not LUL:FindFirstChild('Dismembered') then
- local bsc3 = Instance.new("BallSocketConstraint",LUL)
- bsc3.Attachment0 = LUL.LeftHipRigAttachment
- bsc3.Attachment1 = LT.LeftHipRigAttachment
- table.insert(js,1,bsc3)
- end
- if RF and not RF:FindFirstChild('Dismembered') then
- local bsc4 = Instance.new("BallSocketConstraint",RF)
- bsc4.Attachment0 = RF.RightAnkleRigAttachment
- bsc4.Attachment1 = RLL.RightAnkleRigAttachment
- table.insert(js,1,bsc4)
- end
- if RLL and not RLL:FindFirstChild('Dismembered') then
- local bsc5 = Instance.new("BallSocketConstraint",RLL)
- bsc5.Attachment0 = RLL.RightKneeRigAttachment
- bsc5.Attachment1 = RUL.RightKneeRigAttachment
- table.insert(js,1,bsc5)
- end
- if RUL and not RUL:FindFirstChild('Dismembered') then
- local bsc6 = Instance.new("BallSocketConstraint",RUL)
- bsc6.Attachment0 = RUL.RightHipRigAttachment
- bsc6.Attachment1 = LT.RightHipRigAttachment
- table.insert(js,1,bsc6)
- end
- if LH and not LH:FindFirstChild('Dismembered') then
- local bsc7 = Instance.new("BallSocketConstraint",LH)
- bsc7.Attachment0 = LH.LeftWristRigAttachment
- bsc7.Attachment1 = LLA.LeftWristRigAttachment
- table.insert(js,1,bsc7)
- end
- if LLA and not LLA:FindFirstChild('Dismembered') then
- local bsc8 = Instance.new("BallSocketConstraint",LLA)
- bsc8.Attachment0 = LLA.LeftElbowRigAttachment
- bsc8.Attachment1 = LUA.LeftElbowRigAttachment
- table.insert(js,1,bsc8)
- end
- if LUA and not LUA:FindFirstChild('Dismembered') then
- local bsc9 = Instance.new("BallSocketConstraint",LUA)
- bsc9.Attachment0 = LUA.LeftShoulderAttachment
- bsc9.Attachment1 = UT.LeftCollarAttachment
- table.insert(js,1,bsc9)
- end
- if RH and not RH:FindFirstChild('Dismembered') then
- local bsc10 = Instance.new("BallSocketConstraint",RH)
- bsc10.Attachment0 = RH.RightWristRigAttachment
- bsc10.Attachment1 = RLA.RightWristRigAttachment
- table.insert(js,1,bsc10)
- end
- if RLA and not RLA:FindFirstChild('Dismembered') then
- local bsc11 = Instance.new("BallSocketConstraint",RLA)
- bsc11.Attachment0 = RLA.RightElbowRigAttachment
- bsc11.Attachment1 = RUA.RightElbowRigAttachment
- table.insert(js,1,bsc11)
- end
- if RUA and not RUA:FindFirstChild('Dismembered') then
- local bsc12 = Instance.new("BallSocketConstraint",RUA)
- bsc12.Attachment0 = RUA.RightShoulderAttachment
- bsc12.Attachment1 = UT.RightCollarAttachment
- table.insert(js,1,bsc12)
- end
- if LT and not LT:FindFirstChild('Dismembered') then
- local bsc13 = Instance.new("BallSocketConstraint",LT)
- bsc13.Attachment0 = LT.WaistRigAttachment
- bsc13.Attachment1 = UT.WaistRigAttachment
- table.insert(js,1,bsc13)
- end
- if head and not headless and not head:FindFirstChild('Dismembered') then
- local bsc14 = Instance.new("BallSocketConstraint",head)
- bsc14.Attachment0 = UT.NeckRigAttachment
- bsc14.Attachment1 = head.NeckRigAttachment
- bsc14.LimitsEnabled = true
- bsc14.UpperAngle = -75
- bsc14.TwistLimitsEnabled = true
- bsc14.UpperAngle = -45
- bsc14.TwistLowerAngle = -45
- table.insert(js,1,bsc14)
- else
- --head:BreakJoints()
- end
- end
- else
- hum.Died:Connect(function()
- if hum.RigType==Enum.HumanoidRigType.R15 then
- for _,v in pairs(pc:GetDescendants()) do
- if (v:IsA('Motor6D') or v:IsA('Motor') or v:IsA("BallSocketConstraint")) and (not string.match(v.Name:lower(),'root')) then
- if not kill then
- table.insert(js2,1,{obj = v,par = v.Parent})
- v.Parent = nil
- elseif kill then
- v:Destroy()
- end
- end
- end
- local vis = false
- local vis2 = false
- if LF and not LF:FindFirstChild('Dismembered') then
- local bsc1 = Instance.new("BallSocketConstraint",LF)
- bsc1.Attachment0 = LF.LeftAnkleRigAttachment
- bsc1.Attachment1 = LLL.LeftAnkleRigAttachment
- table.insert(js,1,bsc1)
- end
- if LLL and not LLL:FindFirstChild('Dismembered') then
- local bsc2 = Instance.new("BallSocketConstraint",LLL)
- bsc2.Attachment0 = LLL.LeftKneeRigAttachment
- bsc2.Attachment1 = LUL.LeftKneeRigAttachment
- table.insert(js,1,bsc2)
- end
- if LUL and not LUL:FindFirstChild('Dismembered') then
- local bsc3 = Instance.new("BallSocketConstraint",LUL)
- bsc3.Attachment0 = LUL.LeftHipRigAttachment
- bsc3.Attachment1 = LT.LeftHipRigAttachment
- table.insert(js,1,bsc3)
- end
- if RF and not RF:FindFirstChild('Dismembered') then
- local bsc4 = Instance.new("BallSocketConstraint",RF)
- bsc4.Attachment0 = RF.RightAnkleRigAttachment
- bsc4.Attachment1 = RLL.RightAnkleRigAttachment
- table.insert(js,1,bsc4)
- end
- if RLL and not RLL:FindFirstChild('Dismembered') then
- local bsc5 = Instance.new("BallSocketConstraint",RLL)
- bsc5.Attachment0 = RLL.RightKneeRigAttachment
- bsc5.Attachment1 = RUL.RightKneeRigAttachment
- table.insert(js,1,bsc5)
- end
- if RUL and not RUL:FindFirstChild('Dismembered') then
- local bsc6 = Instance.new("BallSocketConstraint",RUL)
- bsc6.Attachment0 = RUL.RightHipRigAttachment
- bsc6.Attachment1 = LT.RightHipRigAttachment
- table.insert(js,1,bsc6)
- end
- if LH and not LH:FindFirstChild('Dismembered') then
- local bsc7 = Instance.new("BallSocketConstraint",LH)
- bsc7.Attachment0 = LH.LeftWristRigAttachment
- bsc7.Attachment1 = LLA.LeftWristRigAttachment
- table.insert(js,1,bsc7)
- end
- if LLA and not LLA:FindFirstChild('Dismembered') then
- local bsc8 = Instance.new("BallSocketConstraint",LLA)
- bsc8.Attachment0 = LLA.LeftElbowRigAttachment
- bsc8.Attachment1 = LUA.LeftElbowRigAttachment
- table.insert(js,1,bsc8)
- end
- if LUA and not LUA:FindFirstChild('Dismembered') then
- local bsc9 = Instance.new("BallSocketConstraint",LUA)
- bsc9.Attachment0 = LUA.LeftShoulderAttachment
- bsc9.Attachment1 = UT.LeftCollarAttachment
- table.insert(js,1,bsc9)
- end
- if RH and not RH:FindFirstChild('Dismembered') then
- local bsc10 = Instance.new("BallSocketConstraint",RH)
- bsc10.Attachment0 = RH.RightWristRigAttachment
- bsc10.Attachment1 = RLA.RightWristRigAttachment
- table.insert(js,1,bsc10)
- end
- if RLA and not RLA:FindFirstChild('Dismembered') then
- local bsc11 = Instance.new("BallSocketConstraint",RLA)
- bsc11.Attachment0 = RLA.RightElbowRigAttachment
- bsc11.Attachment1 = RUA.RightElbowRigAttachment
- table.insert(js,1,bsc11)
- end
- if RUA and not RUA:FindFirstChild('Dismembered') then
- local bsc12 = Instance.new("BallSocketConstraint",RUA)
- bsc12.Attachment0 = RUA.RightShoulderAttachment
- bsc12.Attachment1 = UT.RightCollarAttachment
- table.insert(js,1,bsc12)
- end
- if LT and not LT:FindFirstChild('Dismembered') then
- local bsc13 = Instance.new("BallSocketConstraint",LT)
- bsc13.Attachment0 = LT.WaistRigAttachment
- bsc13.Attachment1 = UT.WaistRigAttachment
- table.insert(js,1,bsc13)
- end
- if head and not headless and not head:FindFirstChild('Dismembered') then
- local bsc14 = Instance.new("BallSocketConstraint",head)
- bsc14.Attachment0 = UT.NeckRigAttachment
- bsc14.Attachment1 = head.NeckRigAttachment
- bsc14.LimitsEnabled = true
- bsc14.UpperAngle = -75
- bsc14.TwistLimitsEnabled = true
- bsc14.UpperAngle = -45
- bsc14.TwistLowerAngle = -45
- table.insert(js,1,bsc14)
- else
- --head:BreakJoints()
- end
- end
- end)
- end
- end
- end
- return js,js2
- end
- function kill(obj,headshot,lookVector)
- local targchar,targhead,targtorso,targhum,killval
- pcall(function()
- targchar = obj.Parent
- end)
- for i,v in pairs(game:GetService("Players"):GetPlayers()) do
- if v and v.Character and obj:IsDescendantOf(v.Character) then
- targchar = v.Character
- end
- end
- pcall(function()
- targtorso = targchar:FindFirstChild("Torso") or targchar:FindFirstChild("UpperTorso") or targchar:FindFirstChild("HumanoidRootPart")
- end)
- pcall(function()
- targhead = targchar:FindFirstChild("Head")
- end)
- pcall(function()
- targhum = targchar:FindFirstChildOfClass("Humanoid")
- end)
- pcall(function()
- killval = targhum:FindFirstChild("killer")
- end)
- pcall(function()
- decapval = targhum:FindFirstChild("decapped " .. targchar.Name)
- end)
- if targchar and targhead and targtorso and targhum and targhum ~= hum and using then
- targhum:TakeDamage(1/0)
- if 0 >= targhum.Health then
- if (not decapval and headshot) or not killval then
- if not killval then
- local tempkillval = Instance.new("ObjectValue",targhum)
- tempkillval.Name = "killer"
- tempkillval.Value = plr
- end
- local kb = 15
- local bv = Instance.new("BodyVelocity")
- bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- bv.Velocity = lookVector*kb+Vector3.new(0,kb,0)
- bv.Parent = targtorso
- game:GetService("Debris"):AddItem(bv,0.1)
- local ragval = Instance.new("ObjectValue")
- ragval.Name = 'Ragdolled'
- ragval.Parent = targhum
- Ragdoll(targchar,headshot,true,true)
- --bleed2(targtorso,targhum,true,5,true)
- end
- if headshot and not decapval then
- local tempdecapval = Instance.new("ObjectValue",targhum)
- tempdecapval.Name = ("decapped " .. targchar.Name)
- --[[
- local decap_bleed = Instance.new("Sound")
- decap_bleed.SoundId = 'rbxassetid://244502094'
- decap_bleed.Volume = 0.5
- decap_bleed.Parent = targtorso
- decap_bleed:Play()
- local decap_head = Instance.new("Sound")
- decap_head.SoundId = 'rbxassetid://1255040462' --222406108
- decap_head.Volume = 1
- decap_head.Parent = targtorso
- decap_head:Play()
- ]]
- remote:FireClient(plr,1,'rbxassetid://244502094',nil,0.5,targtorso)
- remote:FireClient(plr,1,'rbxassetid://1255040462',nil,1,targtorso)
- local att = Instance.new("Attachment")
- att.Parent = targtorso
- att.Position = Vector3.new(0,targtorso.Size.Y/2,0)
- local blood_emitter = Instance.new("ParticleEmitter")
- blood_emitter.Name = "Blood2"
- blood_emitter.Parent = att
- blood_emitter.Speed = NumberRange.new(5, 14)
- blood_emitter.Color = ColorSequence.new(Color3.new(0.45098, 0, 0),Color3.new(0.45098, 0, 0))
- blood_emitter.LightEmission = 0.20000000298023
- blood_emitter.LightInfluence = 1
- blood_emitter.Texture = "http://www.roblox.com/asset/?id=134531274"
- blood_emitter.Transparency = NumberSequence.new(0.30000001192093,0.30000001192093)
- blood_emitter.ZOffset = 0
- blood_emitter.Size = NumberSequence.new(0.12499988079071,0)
- blood_emitter.Acceleration = Vector3.new(0, -20, 0)
- blood_emitter.Lifetime = NumberRange.new(0.5, 1.5)
- blood_emitter.Rate = 100000
- blood_emitter.SpreadAngle = Vector2.new(90, 90)
- blood_emitter.VelocitySpread = 90
- blood_emitter.Enabled = true
- spawn(function()
- wait(5)
- blood_emitter.Enabled = false
- game:GetService("Debris"):AddItem(blood_emitter,2)
- end)
- end
- end
- end
- end
- function bleed2(frick,targhum,can_hurt,t,splat)
- --spawn(function()
- if not frick:FindFirstChild("bleeding from kry's " .. gun.Name) then else return end
- local tempbleedval = Instance.new("ObjectValue")
- tempbleedval.Name = "bleeding from kry's " .. gun.Name
- tempbleedval.Parent = frick
- local bleeding = true
- 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'}
- spawn(function()
- wait(t)
- bleeding = false
- tempbleedval:Destroy()
- end)
- while bleeding and frick and frick.Parent do
- if --[[(targhum and targhum.Parent and targhum.Health > 0) or]] (not frick or not frick.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
- if gone_limbs >= 1 then
- targhum:TakeDamage(0.5*gone_limbs)
- else
- targhum:TakeDamage(0.5)
- end
- end
- spawn(function()
- local thing = Instance.new('Part')
- thing.Parent = workspace
- 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.Glass
- thing.Name = "blood_drop"
- thing.CanCollide =false
- thing:BreakJoints()
- local mesh = Instance.new('SpecialMesh')
- mesh.MeshType = Enum.MeshType.Sphere
- mesh.Parent = thing
- --game:GetService("Debris"):AddItem(thing,5)
- 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.294118, 0, 0),Color3.new(0.294118, 0, 0))
- trail_drop.FaceCamera = true
- trail_drop.LightInfluence = 1
- trail_drop.Transparency = NumberSequence.new(0.1,1)
- trail_drop.Lifetime = 1
- trail_drop.MinLength = 0
- end
- local rawrxd = Instance.new('BodyForce')
- rawrxd.Parent = thing
- if splat then
- rawrxd.Force = frick.CFrame.upVector+Vector3.new(math.random(-5, 5)/10,3,math.random(-5, 5)/10)
- elseif not splat then
- rawrxd.Force = frick.CFrame.upVector*(math.random()*2)+Vector3.new(math.random(-5, 5)/10,1.5,0)
- end
- 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.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
- if tou.Size.X < 5 then
- tou.Size = tou.Size+Vector3.new(0.4,0,0.4)
- tou.CFrame = reee
- elseif tou.Size.X < 7.5 then
- tou.Size = tou.Size+Vector3.new(0.3,0,0.3)
- tou.CFrame = reee
- elseif tou.Size.X < 10 then
- tou.Size = tou.Size+Vector3.new(0.2,0,0.2)
- tou.CFrame = reee
- end
- elseif tou.CanCollide == true then
- local bloodlol = Instance.new('Part')
- if gone_limbs >= 1 then
- bloodlol.Size = Vector3.new(1*gone_limbs,0.2,1*gone_limbs)
- else
- bloodlol.Size = Vector3.new(1,0.2,1)
- end
- bloodlol.Name = "blood"
- bloodlol.Anchored = true
- bloodlol.CanCollide = false
- bloodlol.Material = Enum.Material.Glass
- bloodlol.Color = Color3.fromRGB(75, 0, 0)
- local mesh = Instance.new('SpecialMesh')
- mesh.MeshType = Enum.MeshType.Sphere
- mesh.Parent = bloodlol
- bloodlol.Parent = workspace
- bloodlol.CFrame = CFrame.new(pos)
- while bloodlol and bloodlol.Parent ~= nil do
- if bloodlol.Transparency < 1 then
- bloodlol.Transparency = bloodlol.Transparency + 0.05
- else
- bloodlol:Destroy()
- end
- wait(0.1)
- end
- end
- end
- end)
- end)
- wait(0.1)
- end
- tempbleedval:Destroy()
- --end)
- end
- function Reload()
- if max_ammo > ammo then else return end
- using = true
- reload_s:Play()
- local mag = Instance.new("Part")
- mag.Name = 'gun mag'
- mag.Size = Vector3.new(0.48, 1.23, 0.14)
- mag.Color = han.Color
- mag.Parent = workspace
- mag.CFrame = han.CFrame * CFrame.new(0.1,-0.1,0)
- debris:AddItem(mag,10)
- repeat wait() until not reload_s.IsPlaying
- ammo = max_ammo
- game:GetService("Debris"):AddItem(mag,10)
- using = false
- end
- function breakwindow(hit)
- if hit and not string.match(hit.Name:lower(),"window shatter") and not string.match(hit.Name:lower(),"blood") then else return end
- local wbreakc = wbreak:Clone()
- wbreakc.Parent = hit
- wbreakc:Play()
- local sx,sy,sz=hit.Size.x,hit.Size.y,hit.Size.z
- hit.Name = "window shatter"
- for x=1,4 do
- for y=1,4 do
- local part=hit:Clone()
- local position=Vector3.new(x-2.1,y-2.1,0)*Vector3.new(sx/4,sy/4,sz)
- part.Size=Vector3.new(sx/4,sy/4,sz)
- part.CFrame=hit.CFrame*(CFrame.new(part.Size/8)-hit.Size/8+position)
- part.Velocity=Vector3.new(math.random(-10,10),math.random(-10,10),math.random(-10,10))
- part.Name="window shatter"
- part.Parent=hit.Parent
- debris:AddItem(part,2)
- spawn(function()
- wait(0.5)
- for i=1,10 do
- part.Transparency=part.Transparency+0.05
- wait(0.05)
- end
- part:Destroy()
- end)
- part.Anchored=false
- end
- end
- hit:Destroy()
- end
- function raycast(Pos,Dir,Max,Ignore)
- return workspace:FindPartOnRayWithIgnoreList(Ray.new(Pos, Dir * (Max or 999.999)), (Ignore or {}), false, true)
- end
- local objhit = {}
- local oldobjhit = {}
- function make_hole(pos,obj,col)
- local BulletHolePart = Instance.new("Part")
- BulletHolePart.Massless = true
- BulletHolePart.Anchored = false
- BulletHolePart.CanCollide = false
- BulletHolePart.Locked = true
- BulletHolePart.FormFactor = "Custom"
- BulletHolePart.TopSurface, BulletHolePart.BottomSurface, BulletHolePart.RightSurface, BulletHolePart.LeftSurface, BulletHolePart.FrontSurface, BulletHolePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- BulletHolePart.Name = "Bullet Hole"
- BulletHolePart.Material = "Plastic"
- BulletHolePart.Reflectance = 0
- BulletHolePart.Transparency = 1
- BulletHolePart.BrickColor = BrickColor.new("Medium stone grey")
- BulletHolePart.Size = Vector3.new(0.3, 0, 0.3)
- BulletHolePart:BreakJoints()
- BulletHolePart.CFrame = pos
- BulletHolePart.Parent = script
- local weld = Instance.new("WeldConstraint")
- weld.Part0 = obj
- weld.Part1 = BulletHolePart
- weld.Parent = obj
- -- game:GetService("Debris"):AddItem(BulletHolePart, 5)
- --[[
- local BulletHoleDecal = Instance.new("Decal")
- BulletHoleDecal.Color3 = Color3.new(col.r, col.g, col.b)
- BulletHoleDecal.Face = "Top"
- BulletHoleDecal.Texture = "rbxassetid://359667865"
- BulletHoleDecal.Transparency = 0
- BulletHoleDecal.Parent = BulletHolePart
- ]]
- remote:FireClient(plr,2,"rbxassetid://359667865","Top",0,BulletHolePart)
- return BulletHolePart
- end
- local blood_images = {931617584,1663434319,1391189545,4533673847,3236192667,2565888666,612591729,120362139,116830967,122022304,131339257,247766282,121678640,176677800,120361912,176678070,176678086,176677869} --305296807,256293532,148713503,176678030
- local e_s = 1
- function add_decal(f,t,obj)
- --spawn(function()
- local texture = Instance.new("Texture")
- texture.Parent = obj
- texture.Face = f
- texture.Texture = 'rbxassetid://' .. t
- if f == 'Left' or f == 'Right' then
- texture.StudsPerTileV = obj.Size.Y + e_s
- if (obj.Size.X > obj.Size.Z) then
- texture.StudsPerTileV = obj.Size.Z + e_s
- elseif (obj.Size.Z > obj.Size.X) then
- texture.StudsPerTileU = obj.Size.X + e_s
- else
- texture.StudsPerTileU = obj.Size.X + e_s
- end
- elseif f == 'Front' or f == 'Back' then
- texture.StudsPerTileV = obj.Size.Y + e_s
- if (obj.Size.X > obj.Size.Z) then
- texture.StudsPerTileV = obj.Size.X + e_s
- elseif (obj.Size.Z > obj.Size.X) then
- texture.StudsPerTileU = obj.Size.Z + e_s
- else
- texture.StudsPerTileU = obj.Size.X + e_s
- end
- elseif f == 'Top' or f == 'Bottom' then
- texture.StudsPerTileV = obj.Size.X + e_s
- texture.StudsPerTileU = obj.Size.Z + e_s
- end
- --end)
- end
- function add_blood(obj)
- local t1,t2,t3,t4,t5,t6 = blood_images[math.random(1,#blood_images)],blood_images[math.random(1,#blood_images)],blood_images[math.random(1,#blood_images)],blood_images[math.random(1,#blood_images)],blood_images[math.random(1,#blood_images)],blood_images[math.random(1,#blood_images)]
- add_decal('Top',t1,obj)
- add_decal('Bottom',t2,obj)
- add_decal('Left',t3,obj)
- add_decal('Right',t4,obj)
- add_decal('Front',t5,obj)
- add_decal('Back',t6,obj)
- end
- function make_bone(obj,targtorso)
- if obj.Name == 'Left Arm' or obj.Name == 'LeftUpperArm' then
- local bone = Instance.new("Part")
- bone.name = 'bone'
- bone.CanCollide = false
- bone.Anchored = false
- bone.CFrame = targtorso.CFrame
- bone.Size = targtorso.Size
- bone.Massless = true
- bone.Locked = true
- 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)
- game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
- game:GetService("PhysicsService"):SetPartCollisionGroup(targtorso,'Limb Collide')
- local weld = Instance.new("Weld")
- weld.Part0 = bone
- weld.Part1 = targtorso
- weld.C1 = CFrame.new(-0.61,0.77,0.03)*CFrame.Angles(math.rad(90),0,math.rad(90))
- weld.Parent = bone
- targtorso.Anchored = false
- bone.Parent = script
- local mesh = Instance.new("SpecialMesh")
- mesh.MeshId = 'rbxassetid://1076136382'
- mesh.TextureId = 'rbxassetid://1076137938'
- mesh.Scale = Vector3.new(0.03,0.03,0.03)
- mesh.Parent = bone
- --
- local bone = Instance.new("Part")
- bone.Name = 'bone'
- bone.CanCollide = false
- bone.Anchored = false
- bone.CFrame = obj.CFrame
- bone.Size = obj.Size
- bone.Massless = true
- bone.Locked = true
- 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)
- game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
- game:GetService("PhysicsService"):SetPartCollisionGroup(obj,'Limb Collide')
- local weld = Instance.new("Weld")
- weld.Part0 = bone
- weld.Part1 = obj
- weld.C1 = CFrame.new(0.13,0.26,0)
- weld.Parent = bone
- obj.Anchored = false
- bone.Parent = script
- local mesh = Instance.new("SpecialMesh")
- mesh.MeshId = 'rbxassetid://36780032'
- mesh.TextureId = 'rbxassetid://36780292'
- mesh.Parent = bone
- elseif obj.Name == 'Right Arm' or obj.Name == 'RightUpperArm' then
- local bone = Instance.new("Part")
- bone.Name = 'bone'
- bone.CanCollide = false
- bone.Anchored = false
- bone.CFrame = targtorso.CFrame
- bone.Size = targtorso.Size
- bone.Massless = true
- bone.Locked = true
- 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)
- game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
- game:GetService("PhysicsService"):SetPartCollisionGroup(targtorso,'Limb Collide')
- local weld = Instance.new("Weld")
- weld.Part0 = bone
- weld.Part1 = targtorso
- weld.C1 = CFrame.new(0.61,0.77,0.03)*CFrame.Angles(math.rad(90),0,math.rad(-90))
- weld.Parent = bone
- targtorso.Anchored = false
- bone.Parent = script
- local mesh = Instance.new("SpecialMesh")
- mesh.MeshId = 'rbxassetid://1076136382'
- mesh.TextureId = 'rbxassetid://1076137938'
- mesh.Scale = Vector3.new(0.03,0.03,0.03)
- mesh.Parent = bone
- --
- local bone = Instance.new("Part")
- bone.Name = 'bone'
- bone.CanCollide = false
- bone.Anchored = false
- bone.CFrame = obj.CFrame
- bone.Size = obj.Size
- bone.Massless = true
- bone.Locked = true
- 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)
- game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
- game:GetService("PhysicsService"):SetPartCollisionGroup(obj,'Limb Collide')
- local weld = Instance.new("Weld")
- weld.Part0 = bone
- weld.Part1 = obj
- weld.C1 = CFrame.new(-0.13,0.26,0)
- weld.Parent = bone
- obj.Anchored = false
- bone.Parent = script
- local mesh = Instance.new("SpecialMesh")
- mesh.MeshId = 'rbxassetid://36780156'
- mesh.TextureId = 'rbxassetid://36780292'
- mesh.Parent = bone
- elseif obj.Name == 'Left Leg' or obj.Name == 'LeftUpperLeg' then
- local bone = Instance.new("Part")
- bone.Name = 'bone'
- bone.CanCollide = false
- bone.Anchored = false
- bone.CFrame = targtorso.CFrame
- bone.Size = targtorso.Size
- bone.Massless = true
- bone.Locked = true
- 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)
- game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
- game:GetService("PhysicsService"):SetPartCollisionGroup(targtorso,'Limb Collide')
- local weld = Instance.new("Weld")
- weld.Part0 = bone
- weld.Part1 = targtorso
- weld.C1 = CFrame.new(-0.6,-0.64,0.11)*CFrame.Angles(0,0,math.rad(180))
- weld.Parent = bone
- targtorso.Anchored = false
- bone.Parent = script
- local mesh = Instance.new("SpecialMesh")
- mesh.MeshId = 'rbxassetid://1076136382'
- mesh.TextureId = 'rbxassetid://1076137938'
- mesh.Scale = Vector3.new(0.03,0.03,0.03)
- mesh.Parent = bone
- --
- local bone = Instance.new("Part")
- bone.Name = 'bone'
- bone.CanCollide = false
- bone.Anchored = false
- bone.CFrame = obj.CFrame
- bone.Size = obj.Size
- bone.Massless = true
- bone.Locked = true
- 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)
- game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
- game:GetService("PhysicsService"):SetPartCollisionGroup(obj,'Limb Collide')
- local weld = Instance.new("Weld")
- weld.Part0 = bone
- weld.Part1 = obj
- weld.C1 = CFrame.new(0,0.09,0.13)
- weld.Parent = bone
- obj.Anchored = false
- bone.Parent = script
- local mesh = Instance.new("SpecialMesh")
- mesh.MeshId = 'rbxassetid://36780156'
- mesh.TextureId = 'rbxassetid://36780292'
- mesh.Parent = bone
- elseif obj.Name == 'Right Leg' or obj.Name == 'RightUpperLeg' then
- local bone = Instance.new("Part")
- bone.Name = 'bone'
- bone.CanCollide = false
- bone.Anchored = false
- bone.CFrame = targtorso.CFrame
- bone.Size = targtorso.Size
- bone.Massless = true
- bone.Locked = true
- 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)
- game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
- game:GetService("PhysicsService"):SetPartCollisionGroup(targtorso,'Limb Collide')
- local weld = Instance.new("Weld")
- weld.Part0 = bone
- weld.Part1 = targtorso
- weld.C1 = CFrame.new(0.6,-0.64,0.11)*CFrame.Angles(0,0,math.rad(180))
- weld.Parent = bone
- targtorso.Anchored = false
- bone.Parent = script
- local mesh = Instance.new("SpecialMesh")
- mesh.MeshId = 'rbxassetid://1076136382'
- mesh.TextureId = 'rbxassetid://1076137938'
- mesh.Scale = Vector3.new(0.03,0.03,0.03)
- mesh.Parent = bone
- --
- local bone = Instance.new("Part")
- bone.Name = 'bone'
- bone.CanCollide = false
- bone.Anchored = false
- bone.CFrame = obj.CFrame
- bone.Size = obj.Size
- bone.Massless = true
- bone.Locked = true
- 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)
- game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
- game:GetService("PhysicsService"):SetPartCollisionGroup(obj,'Limb Collide')
- local weld = Instance.new("Weld")
- weld.Part0 = bone
- weld.Part1 = obj
- weld.C1 = CFrame.new(0,0.09,0.13)
- weld.Parent = bone
- obj.Anchored = false
- bone.Parent = script
- local mesh = Instance.new("SpecialMesh")
- mesh.MeshId = 'rbxassetid://36780195'
- mesh.TextureId = 'rbxassetid://36780292'
- mesh.Parent = bone
- elseif obj.Name == 'Head' then
- local bone = Instance.new("Part")
- bone.Name = 'bone'
- bone.CanCollide = false
- bone.Anchored = false
- bone.CFrame = targtorso.CFrame
- bone.Size = targtorso.Size
- bone.Massless = true
- bone.Locked = true
- 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)
- game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
- game:GetService("PhysicsService"):SetPartCollisionGroup(targtorso,'Limb Collide')
- local weld = Instance.new("Weld")
- weld.Part0 = bone
- weld.Part1 = targtorso
- weld.C1 = CFrame.new(0,0.66,0)
- weld.Parent = bone
- targtorso.Anchored = false
- bone.Parent = script
- local mesh = Instance.new("SpecialMesh")
- mesh.MeshId = 'rbxassetid://1076136382'
- mesh.TextureId = 'rbxassetid://1076137938'
- mesh.Scale = Vector3.new(0.03,0.03,0.03)
- mesh.Parent = bone
- --
- local bone = Instance.new("Part")
- bone.Name = 'bone'
- bone.CanCollide = false
- bone.Anchored = false
- bone.CFrame = obj.CFrame
- bone.Size = obj.Size
- bone.Massless = true
- bone.Locked = true
- 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)
- game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
- game:GetService("PhysicsService"):SetPartCollisionGroup(obj,'Limb Collide')
- local weld = Instance.new("Weld")
- weld.Part0 = bone
- weld.Part1 = obj
- weld.C1 = CFrame.new(0,-0.23,0)*CFrame.Angles(0,math.rad(-90),0)
- weld.Parent = bone
- obj.Anchored = false
- bone.Parent = script
- local mesh = Instance.new("SpecialMesh")
- mesh.MeshId = 'rbxassetid://1076136382'
- mesh.TextureId = 'rbxassetid://1076137938'
- mesh.Scale = Vector3.new(0.03,0.03,0.03)
- mesh.Parent = bone
- end
- end
- function break_limb(obj,rig,targtorso,targhum)
- if 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 confirm = Instance.new("ObjectValue")
- confirm.Name = 'Dismembered'
- confirm.Parent = obj
- local bsc = obj:FindFirstChildOfClass("BallSocketConstraint")
- if bsc then
- bsc:Destroy()
- end
- --bleed2(obj,targhum,false,5,false)
- add_blood(obj)
- make_bone(obj,targtorso)
- local kb = 15
- local bv = Instance.new("BodyVelocity")
- bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- bv.Velocity = han.CFrame.lookVector*kb+Vector3.new(0,kb,0)
- bv.Parent = obj
- game:GetService("Debris"):AddItem(bv,0.1)
- if rig == Enum.HumanoidRigType.R6 then
- local bsc = obj:FindFirstChildOfClass("BallSocketConstraint")
- if bsc then
- bsc:Destroy()
- end
- for i,v in pairs(targtorso:GetChildren()) do
- if v:IsA("Motor6D") then
- if obj.Name == 'Head' and v.Name == 'Neck' then
- v:Destroy()
- elseif obj.Name == 'Left Arm' and v.Name == 'Left Shouldver' then
- v:Destroy()
- elseif obj.Name == 'Right Arm' and v.Name == 'Right Shoulder' then
- v:Destroy()
- elseif obj.Name == 'Left Leg' and v.Name == 'Left Hip' then
- if obj.Parent:FindFirstChild("Right Leg") then
- targhum.WalkSpeed = targhum.WalkSpeed/2
- else
- targhum.WalkSpeed = 0
- end
- v:Destroy()
- elseif obj.Name == 'Right Leg' and v.Name == 'Right Hip' then
- if obj.Parent:FindFirstChild("Left Leg") then
- targhum.WalkSpeed = targhum.WalkSpeed/2
- else
- targhum.WalkSpeed = 0
- end
- v:Destroy()
- end
- end
- end
- elseif rig == Enum.HumanoidRigType.R15 then
- for i,v in pairs(obj:GetChildren()) do
- if v:IsA("Motor6D") then
- if (obj.Name == 'LeftUpperLeg' and obj.Parent:FindFirstChild("RightUpperLeg")) or (obj.Name == 'RightUpperLeg' and obj.Parent:FindFirstChild("LeftUpperLeg")) then
- targhum.WalkSpeed = targhum.WalkSpeed/2
- elseif obj.Name == 'RightUpperLeg' or obj.Name == 'LeftUpperLeg' then
- targhum.WalkSpeed = 0
- end
- v:Destroy()
- end
- end
- end
- 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
- cb.Massless = true
- cb.Locked = true
- 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)
- 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
- cb.Parent = script
- end
- function check(toughness,obj,objpos,p,rays,rot)
- local plrhit = false
- if obj and not obj:FindFirstChild('Dismembered') then else return; end;
- local targchar,targtorso,targhum,targhead
- pcall(function()
- targchar = obj.Parent
- end)
- for i,v in pairs(game:GetService("Players"):GetPlayers()) do
- if v and v.Character and obj:IsDescendantOf(v.Character) then
- targchar = v.Character
- end
- end
- pcall(function()
- targtorso = targchar:FindFirstChild("Torso") or targchar:FindFirstChild("UpperTorso") or targchar:FindFirstChild("HumanoidRootPart")
- end)
- pcall(function()
- targhum = targchar:FindFirstChildOfClass("Humanoid")
- end)
- pcall(function()
- targhead = targchar:FindFirstChild("Head")
- end)
- if targchar and targchar.Parent and targtorso and targtorso.Parent and targhum and targhum.Parent and targhum ~= hum and targhead and targhead.Parent and not targhum:FindFirstChild("hit " .. targchar.Name .. " with " .. gun.Name .. " by " .. plr.Name) then
- plrhit = true
- local confirm = Instance.new("IntValue")
- confirm.Parent = targhum
- confirm.Name = ("hit " .. targchar.Name .. " with " .. gun.Name .. " by " .. plr.Name)
- debris:AddItem(confirm,shootwait)
- local dmg = math.random(30,40)
- if obj == targhead then
- dmg = math.random(45,55)
- targhum:TakeDamage(dmg)
- elseif not op then
- dmg = math.random(20,30)
- targhum:TakeDamage(dmg)
- elseif op then
- targhum.MaxHealth = 0
- targhum.Health = 0
- targhum.Parent:BreakJoints()
- end
- if math.random(1,5) == 1 then
- break_limb(obj,targhum.RigType,targtorso,targhum)
- end
- add_blood(obj)
- --[[
- local bleeding = Instance.new("Sound")
- bleeding.SoundId = 'rbxassetid://360007673'
- bleeding.Volume = 1
- bleeding.Parent = targtorso
- bleeding:Play()
- ]]
- remote:FireClient(plr,1,'rbxassetid://360007673',nil,1,targtorso)
- if 0 >= targhum.Health and obj == targhead then
- kill(obj,true,p.CFrame.lookVector)
- elseif 0 >= targhum.Health then
- kill(obj,false,p.CFrame.lookVector)
- elseif targhum.Health > 0 then
- --bleed2(targtorso,targhum,true,5,false)
- end
- else
- table.insert(objhit,1,obj)
- local mat = obj.Material
- local mathit = obj:FindFirstChild('material hit ' .. plr.Name)
- if not mathit and toughness > 0 and 1 > obj.Transparency then
- --print('old: ' .. toughness)
- if (mat == Enum.Material.Glass or mat == Enum.Material.Ice) then
- breakwindow(obj)
- elseif (mat == Enum.Material.Wood or mat == Enum.Material.WoodPlanks) then
- toughness = toughness - 1.5
- elseif (mat == Enum.Material.Metal or mat == Enum.Material.DiamondPlate or mat == Enum.Material.CorrodedMetal) then
- toughness = toughness - 5
- elseif (mat == Enum.Material.Brick or mat == Enum.Material.Concrete or mat == Enum.Material.Cobblestone or mat == Enum.Material.Granite or mat == Enum.Material.Slate or mat == Enum.Material.Pebble) then
- toughness = toughness - 3
- else
- toughness = toughness - 1
- end
- --print('new: ' .. toughness)
- local libruary = {
- ['wizz'] = {342190005, 342190012, 342190017, 342190024},
- ['crackSmall'] = {873119768, 873119788, 873119811, 873119845, 873119886, 873119904},
- ['crackBig'] = {873119597, 873119653, 873119679, 873119703, 873119724, 873119744},
- ['whizz'] = {873121840, 873121858, 873121876, 873121896, 873121913, 873121936},
- ['woodhit'] = {342204157, 342204164, 342204170, 342204175, 871705143, 871705174}, --871705195, 871705217, 871705237, 871705264
- ['stonehit'] = {871701076, 871701134, 871701190, 871701241, 871701297, 871701346},
- ['metalhit'] = {871704182, 871704259, 871704297, 871704329, 871704362, 871704395},
- ['grasshit'] = {871709869, 871709832, 871709789, 871709755, 871709708, 871709643},
- ['impact'] = {525720625},
- }
- local soundfont=({
- Brick="stonehit";
- Cobblestone="stonehit";
- Concrete="stonehit";
- CorrodedMetal="metalhit";
- DiamondPlate="metalhit";
- Fabric=nil;
- Foil="metalhit";
- Granite="stonehit";
- Grass="grasshit";
- Ice="stonehit";
- Marble="stonehit";
- Metal="metalhit";
- Neon=nil;
- Pebble="stonehit";
- Plastic="metalhit";
- Sand=nil;
- Slate="stonehit";
- SmoothPlastic="metalhit";
- Wood="woodhit";
- WoodPlanks="woodhit";
- })[mat.Name]
- local part = make_hole(CFrame.new(objpos, objpos - rot) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(0)) * CFrame.Angles(math.rad(0), math.rad(math.random(-360, 360)), math.rad(0)), obj, obj.BrickColor)
- --[[
- local BulletHoleSound = Instance.new("Sound")
- BulletHoleSound.Volume = 3
- BulletHoleSound.Pitch = math.random(9,11)/10
- ]]
- local _id = ''
- if soundfont ~= nil then
- --[[BulletHoleSound.SoundId]]_id = "rbxassetid://"..libruary[soundfont][math.random(1,6)]
- else
- --[[BulletHoleSound.SoundId]]_id = "rbxassetid://"..libruary['impact'][1]
- end
- --BulletHoleSound.Parent = part
- --BulletHoleSound:Play()
- remote:FireClient(plr,1,_id,nil,3,part)
- local tempmathit = Instance.new("ObjectValue")
- tempmathit.Name = ('material hit ' .. plr.Name)
- tempmathit.Parent = obj
- game:GetService("Debris"):AddItem(tempmathit,shootwait/bulletfire)
- game:GetService("Debris"):AddItem(part,7)
- end
- end
- if toughness > 0 and rays > 0 then
- local found = false
- for i,v in pairs(oldobjhit) do if v and obj:IsDescendantOf(v) then found = true; end; end;
- oldobjhit = objhit
- if not plrhit and not found then
- rays = rays - 1
- wait()
- end
- local ig = {char,gun,script,unpack(objhit)}
- local _obj,_vec,_rot = raycast(objpos,(hitpos-han.Position).Unit, nil, ig) -- (hitpos-objpos).Unit
- check(toughness,_obj,_vec,p,rays,_rot)
- else
- p:Destroy()
- end
- end
- function drop_shell()
- local Shell = Instance.new("Part")
- Shell.Color = Color3.new(1, 1, 0)
- Shell.Size = Vector3.new(0.530001819, 0.132500455, 0.132500455)
- Shell.BottomSurface = Enum.SurfaceType.Smooth
- Shell.BrickColor = BrickColor.new("New Yeller")
- Shell.Material = Enum.Material.Metal
- Shell.Shape = Enum.PartType.Cylinder
- Shell.CFrame = han.CFrame
- Shell.Parent = script
- local bvs = Instance.new("BodyVelocity")
- bvs.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- bvs.Velocity = han.CFrame.lookVector+Vector3.new(0,10,-5)
- bvs.Parent = Shell
- game:GetService("Debris"):AddItem(bvs,0.1)
- game:GetService("Debris"):AddItem(Shell,10)
- end
- function Shoot()
- if not using and CheckIfAlive() and ammo > 0 then
- using = true
- wait()
- tween:Create(gun,TweenInfo.new(0.1),({Grip = CFrame.new(1.22123134, -0.0217182189, -0.00732704997, -4.33653078e-08, -0.12558721, 0.992082715, -5.489591e-09, 0.992082655, 0.125587225, -1, 0, -4.37113883e-08)})):Play()
- spawn(function()
- flash.Enabled = true
- light.Enabled = true
- smoke.Enabled = true
- wait()
- flash.Enabled = false
- light.Enabled = false
- smoke.Enabled = false
- end)
- spawn(function()
- for i = 1,bulletfire do
- ammo = ammo - 1
- drop_shell()
- --shoot_s.SoundId = 'rbxassetid://' .. shots[math.random(1,#shots)]
- shoot_s:Play()
- for i,v in ipairs(objhit) do table.remove(objhit,i); end;
- for i,v in ipairs(objhit) do table.remove(oldobjhit,i); end;
- spawn(function()
- local p = Instance.new("Part")
- p.Name = "bullet"
- p.Massless = true
- p.Anchored = false
- p.CanCollide = false
- p.Color = Color3.fromRGB(255, 255, 0)
- p.Size = Vector3.new(0.5,0.5,1)
- p.Transparency = 0
- p.Position = han.Position
- p.CFrame = CFrame.new(han.Position,hitpos)
- p.Velocity = p.CFrame.lookVector * 2000
- p.Material = Enum.Material.Neon
- p.Parent = script
- local mesh = Instance.new("SpecialMesh")
- mesh.MeshType = Enum.MeshType.Sphere
- mesh.Parent = p
- --tween:Create(p,TweenInfo.new(((hitpos)-han.Position).Magnitude/10000),{Position = p.Position + ((hitpos)-han.Position).Unit*1000}):Play()
- local body_vel = Instance.new("BodyVelocity")
- body_vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- body_vel.Velocity = p.CFrame.lookVector * 2000
- body_vel.Parent = p
- debris:AddItem(p,3)
- game:GetService("TweenService"):Create(p,TweenInfo.new(3),{Size = Vector3.new(0.5,0.5,10),Transparency = 1}):Play()
- local toughness = 3
- local rays = 5
- local ig = {char,gun,script}
- local obj,vec,rot = raycast(han.Position,(hitpos-han.Position).Unit, nil, ig)
- check(toughness,obj,vec,p,rays,rot)
- end)
- remote:FireClient(plr,1,shoot_s.SoundId,shoot_s,5,han)
- wait(shootwait/bulletfire)
- end
- end)
- spawn(function()
- wait(0.1)
- tween:Create(gun,TweenInfo.new(0.1),({Grip = CFrame.new(1.25958824, -0.0798366517, -0.00732704997, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)})):Play()
- end)
- wait(shootwait)
- using = false
- end
- end
- gun.Activated:Connect(function()
- if not using and CheckIfAlive() and 0 >= ammo then
- Reload()
- end
- end)
- gun.Equipped:Connect(function()
- equipped = true
- pcall(function()
- char = gun.Parent
- plr = game:GetService("Players"):GetPlayerFromCharacter(char)
- hum = char:FindFirstChildOfClass("Humanoid")
- torso = char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso")
- rootpart = char:FindFirstChild("HumanoidRootPart")
- if not CheckIfAlive() then gun.Parent = nil return end
- end)
- end)
- gun.Unequipped:Connect(function()
- equipped = false
- end)
- remote = Instance.new("RemoteEvent")
- remote.Name = 'badger_remote'
- remote.Parent = gun
- remote.OnServerEvent:Connect(function(player,mode,data,data2)
- if equipped then else return end
- if plr == player and mode == 1 then
- if data ~= nil then
- hitpos = data
- end
- if data2 ~= nil then
- shooting = data2
- end
- if shooting then
- Shoot()
- end
- elseif not shooting and not using and CheckIfAlive() and plr == player and mode == 2 and data == 'reload' then
- Reload()
- end
- end)
- local ls = [[
- local plr = game:GetService("Players").LocalPlayer
- local mouse = plr:GetMouse()
- local char = plr.Character
- local remote = script.Parent
- local tool = remote.Parent
- local shooting = false
- local lh = Vector3.new()
- tool.Equipped:Connect(function()
- pcall(function()
- char = tool.Parent
- end)
- pcall(function()
- plr = game:GetService("Players"):GetPlayerFromCharacter(char)
- end)
- pcall(function()
- mouse = plr:GetMouse()
- end)
- if mouse then
- mouse.KeyDown:Connect(function(key)
- if key == 'r' then
- remote:FireServer(2,'reload')
- end
- end)
- mouse.Button1Down:Connect(function()
- shooting = true
- while shooting do
- local pos
- if mouse.Hit then
- pos = mouse.Hit.Position
- end
- lh = pos or Vector3.new()
- remote:FireServer(1,pos,true)
- wait(0.06)
- end
- remote:FireServer(1,lh,false)
- end)
- mouse.Button1Up:Connect(function()
- shooting = false
- end)
- end
- end)
- remote.OnClientEvent:Connect(function(mode,data,inst,v,p)
- if mode == 1 then
- if inst then inst.Volume = 0; end;
- local sound = Instance.new("Sound")
- sound.SoundId = data
- sound.Volume = v
- sound.Parent = p
- sound:Play()
- elseif mode == 2 then
- --if inst then inst.Transparency = 1; end;
- local decal = Instance.new("Decal")
- decal.Texture = data
- decal.Transparency = v
- decal.Parent = p
- decal.Face = inst
- end
- end)
- ]]
- NLS(ls,remote)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement