Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --funny ragdoll
- --[[This ragdoll mostly for r15 is actually cool tho]]
- --By Rufus14
- mouse = game.Players.LocalPlayer:GetMouse()
- hum = game.Players.LocalPlayer.Character.Humanoid
- gun = Instance.new("Part", game.Players.LocalPlayer.Character)
- gun.BrickColor = BrickColor.Black()
- gun.BrickColor = BrickColor.Black()
- gun.BrickColor = BrickColor.Black()
- gun.Size = Vector3.new(0.5, 1, 2)
- gun.CanCollide = true
- gun:BreakJoints()
- swooshing = Instance.new("Sound", gun)
- swooshing.SoundId = "rbxassetid://301184111"
- swooshing.EmitterSize = 1
- swooshing.PlaybackSpeed = 0.9
- swooshing.Volume = 10
- weld = Instance.new("Weld", gun)
- weld.Part0 = game.Players.LocalPlayer.Character["RightUpperArm"]
- weld.Part1 = gun
- weld.C0 = weld.C0 * CFrame.new(-0.2,-1.7,-0.25) * CFrame.Angles(0,1.6,-1.53)
- mesh = Instance.new("SpecialMesh", gun)
- mesh.MeshId = "rbxassetid://623102664"
- mesh.Scale = Vector3.new(0.01,0.01,0.01)
- local rhandweld = Instance.new("Weld", game.Players.LocalPlayer.Character.UpperTorso)
- shooting = false
- for i = 1,2 do
- wait()
- rhandweld.C0 = rhandweld.C0 * CFrame.Angles(0,0,0.03)
- end
- for i = 1,2 do
- wait()
- rhandweld.C0 = rhandweld.C0 * CFrame.Angles(0,0,0.07)
- end
- swooshing:Play()
- for i = 1,7 do
- wait()
- rhandweld.C0 = rhandweld.C0 * CFrame.Angles(0,0,0.17)
- end
- for i = 1,2 do
- wait()
- rhandweld.C0 = rhandweld.C0 * CFrame.Angles(0,0,0.07)
- end
- for i = 1,2 do
- wait()
- rhandweld.C0 = rhandweld.C0 * CFrame.Angles(0,0,0.03)
- end
- function shoot()
- if not shooting then
- shooting = true
- local shotsound = Instance.new("Sound", gun)
- shotsound.EmitterSize = 1
- shotsound.SoundId = "rbxassetid://131070686"
- shotsound.Volume = 10
- shotsound:Play()
- local blast = Instance.new("Part", gun)
- blast.Size = Vector3.new(1,1.6,1.6)
- blast.BrickColor = BrickColor.White()
- blast.Shape = 1
- blast.Material = "Neon"
- blast.CanCollide = false
- blast:BreakJoints()
- local missle = Instance.new("Part", workspace)
- missle.Size = Vector3.new(0.2,0.2,0.2)
- missle.CanCollide = false
- missle.Material = "Neon"
- missle.Shape = "Ball"
- missle.BrickColor = BrickColor.new("New Yeller")
- missle.Transparency = 0.2
- missle.CFrame = gun.CFrame * CFrame.new(0,5.5,0)
- missle:BreakJoints()
- local ligh = Instance.new("PointLight", gun)
- ligh.Range = 10
- ligh.Color = missle.Color
- ligh.Enabled = true
- local velo = Instance.new("BodyVelocity", missle)
- velo.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- velo.Velocity = mouse.Hit.lookVector * 180
- local weld1 = Instance.new("Weld", gun)
- weld1.Part0 = gun
- weld1.Part1 = blast
- weld1.C0 = weld1.C0 * CFrame.new(1.5,-1,0) * CFrame.Angles(0,0,-0.5)
- for i = 1,2 do
- weld.C0 = weld.C0 * CFrame.Angles(0,0,0.14)
- rhandweld.C0 = rhandweld.C0 * CFrame.Angles(0,0,0.14)
- end
- for i = 1,1 do
- wait()
- weld.C0 = weld.C0 * CFrame.Angles(0,0,-0.07)
- rhandweld.C0 = rhandweld.C0 * CFrame.Angles(0,0,-0.07)
- end
- blast:destroy()
- ligh:destroy()
- for i = 1,1 do
- wait()
- weld.C0 = weld.C0 * CFrame.Angles(0,0,-0.07)
- rhandweld.C0 = rhandweld.C0 * CFrame.Angles(0,0,-0.07)
- end
- local function kill(part)
- local hum = part.Parent:findFirstChild("Humanoid")
- local UpperTorso = part.Parent:findFirstChild("UpperTorso")
- local larm = part.Parent:findFirstChild("LeftUpperArm")
- local rarm = part.Parent:findFirstChild("RightUpperArm")
- local lleg = part.Parent:findFirstChild("LeftUpperLeg")
- local rleg = part.Parent:findFirstChild("RightUpperLeg")
- missle:destroy()
- if hum ~= nil then
- if UpperTorso then
- HumanoidDMG = {12,23,21,14,16,30,9}
- DMG = HumanoidDMG[math.random(1,#HumanoidDMG)]
- hum.Health = hum.Health - DMG
- local shotsound1 = Instance.new("Sound", UpperTorso)
- shotsound1:Play()
- shotsound1.EmitterSize = 2
- shotsound1.SoundId = "rbxassetid://131070686"
- shotsound1.Volume = 8
- shotsound1:Play()
- local shotsound1 = Instance.new("Sound", UpperTorso)
- shotsound1:Play()
- shotsound1.EmitterSize = 2
- shotsound1.SoundId = "rbxassetid://131070686"
- shotsound1.Volume = 8
- shotsound1:Play()
- using = false
- hit = Instance.new("Sound", UpperTorso)
- hit.SoundId = "rbxassetid://173137001"
- hit.Volume = 5
- hit1 = Instance.new("Sound", UpperTorso)
- hit1.SoundId = "rbxassetid://132236830"
- hit1.Volume = 5
- hit2 = Instance.new("Sound", UpperTorso)
- hit2.SoundId = "rbxassetid://899623922"
- hit2.Volume = 5
- hit3 = Instance.new("Sound", UpperTorso)
- hit3.SoundId = "rbxassetid://278062209"
- hit3.Volume = 5
- hit3.TimePosition = 0.33
- print("You killed "..hum.Parent.Name)
- hum.PlatformStand = true
- ----------
- local lhip = UpperTorso:findFirstChild("Left Hip")
- if lhip then
- ---
- UpperTorso["Left Hip"]:destroy()
- local head = game.Players.LocalPlayer.Character.Head
- local glue = Instance.new("Glue", UpperTorso)
- glue.Part0 = UpperTorso
- glue.Part1 = UpperTorso.Parent["LeftUpperLeg"]
- glue.Name = "LeftUpperLeg"
- local collider = Instance.new("Part", UpperTorso.Parent["LeftUpperLeg"])
- collider.Position = Vector3.new(0,999,0)
- collider.Size = Vector3.new(1.7, 1, 1)
- collider.Shape = "Cylinder"
- local weld = Instance.new("Weld", collider)
- weld.Part0 = UpperTorso.Parent["LeftUpperLeg"]
- weld.Part1 = collider
- weld.C0 = CFrame.Angles(0, 0, 80)
- collider.TopSurface = "Smooth"
- collider.BottomSurface = "Smooth"
- collider.formFactor = "Symmetric"
- glue.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- glue.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- collider.Transparency = 1
- end
- local rhip = UpperTorso:findFirstChild("Right Hip")
- if rhip then
- ------------
- UpperTorso["Right Hip"]:destroy()
- local glue1 = Instance.new("Glue", UpperTorso)
- glue1.Part0 = UpperTorso
- glue1.Part1 = UpperTorso.Parent["RightUpperLeg"]
- glue1.Name = "RightUpperLeg"
- local collider1 = Instance.new("Part", UpperTorso.Parent["RightUpperLeg"])
- collider1.Position = Vector3.new(0,9999,0)
- collider1.Size = Vector3.new(1.7, 1, 1)
- collider1.Shape = "Cylinder"
- local weld1 = Instance.new("Weld", collider1)
- weld1.Part0 = UpperTorso.Parent["RightUpperLeg"]
- weld1.Part1 = collider1
- weld1.C0 = CFrame.Angles(0, 0, 80)
- collider1.TopSurface = "Smooth"
- collider1.BottomSurface = "Smooth"
- collider1.formFactor = "Symmetric"
- glue1.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- glue1.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- collider1.Transparency = 1
- end
- ------------
- local rshoulder = UpperTorso:findFirstChild("Right Shoulder")
- if rshoulder then
- UpperTorso["Right Shoulder"]:destroy()
- local glue11 = Instance.new("Glue", UpperTorso)
- glue11.Part0 = UpperTorso
- glue11.Part1 = UpperTorso.Parent["RightUpperArm"]
- glue11.Name = "Right shoulder"
- local collider11 = Instance.new("Part", UpperTorso.Parent["RightUpperArm"])
- collider11.Position = Vector3.new(0,9999,0)
- collider11.Size = Vector3.new(1.8,1,1)
- collider11.Shape = "Cylinder"
- local weld11 = Instance.new("Weld", collider11)
- weld11.Part0 = UpperTorso.Parent["RightUpperArm"]
- weld11.Part1 = collider11
- weld11.C0 = CFrame.Angles(0, 0, 80)
- collider11.TopSurface = "Smooth"
- collider11.BottomSurface = "Smooth"
- collider11.formFactor = "Symmetric"
- glue11.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- glue11.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- collider11.Transparency = 1
- end
- ------------
- local lshoulder = UpperTorso:findFirstChild("Left Shoulder")
- if lshoulder then
- UpperTorso["Left Shoulder"]:destroy()
- local glue111 = Instance.new("Glue", UpperTorso)
- glue111.Part0 = UpperTorso
- glue111.Part1 = UpperTorso.Parent["LeftUpperArm"]
- glue111.Name = "Left shoulder"
- local collider111 = Instance.new("Part", UpperTorso.Parent["LeftUpperArm"])
- collider111.Position = Vector3.new(0,9999,0)
- collider111.Size = Vector3.new(1.8,1,1)
- collider111.Shape = "Cylinder"
- local weld111 = Instance.new("Weld", collider111)
- weld111.Part0 = UpperTorso.Parent["LeftUpperArm"]
- weld111.Part1 = collider111
- weld111.C0 = CFrame.Angles(0, 0, 80)
- collider111.TopSurface = "Smooth"
- collider111.BottomSurface = "Smooth"
- collider111.formFactor = "Symmetric"
- glue111.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- glue111.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- collider111.Transparency = 1
- end
- -----------------
- local sensoring = Instance.new("Part", UpperTorso)
- sensoring.Size = Vector3.new(1.2,1.1,0.8)
- sensoring.CanCollide = false
- sensoring.Position = UpperTorso.Position
- local welder = Instance.new("Weld", sensoring)
- welder.Part0 = UpperTorso
- welder.Part1 = sensoring
- welder.C0 = welder.C0 * CFrame.new(0,0,1.05)
- sensoring.Transparency = 1
- -----------------
- local sensoring1 = Instance.new("Part", UpperTorso)
- sensoring1.Size = Vector3.new(1.2,1.1,0.8)
- sensoring1.CanCollide = false
- sensoring1.Position = UpperTorso.Position
- local welder1 = Instance.new("Weld", sensoring)
- welder1.Part0 = UpperTorso
- welder1.Part1 = sensoring1
- welder1.C0 = welder1.C0 * CFrame.new(0,0,-1.05)
- sensoring1.Transparency = 1
- local function touch()
- if not using then
- using = true
- local Math = math.random(1,4)
- if Math == 1 then
- hit:Play()
- end
- if Math == 2 then
- hit1:Play()
- end
- if Math == 3 then
- hit2:Play()
- end
- if Math == 4 then
- hit3:Play()
- end
- wait(0.1)
- using = false
- end
- end
- sensoring.Touched:connect(touch)
- sensoring1.Touched:connect(touch)
- if part.Name == "Head" then
- local hed = Instance.new("Sound", UpperTorso)
- hed.SoundId = "rbxassetid://147936251"
- hed.Volume = 5
- hed:Play()
- hum.Health = 555
- local UUUHUUH = Instance.new("Sound", UpperTorso)
- UUUHUUH.SoundId = "rbxassetid://666800317"
- UUUHUUH.Volume = 5
- UUUHUUH:Play()
- for i,v in pairs(UpperTorso.Parent:GetChildren()) do
- if v.ClassName == "Hat" or v.ClassName == "Accessory" then
- v:destroy()
- end
- end
- for i,v in pairs(UpperTorso.Parent.Head:GetChildren()) do
- if v.ClassName == "Decal" then
- v:destroy()
- end
- end
- UpperTorso.Parent.Head.Transparency = 1
- wait(4)
- hum.Health = hum.Health - 12
- end
- while true do
- wait(0.3)
- hum.PlatformStand = true
- end
- --di ent
- end
- end
- end
- missle.Touched:connect(kill)
- for i = 1,2 do
- wait()
- weld.C0 = weld.C0 * CFrame.Angles(0,0,-0.07)
- rhandweld.C0 = rhandweld.C0 * CFrame.Angles(0,0,-0.07)
- end
- shooting = false
- wait(3)
- shotsound:destroy()
- end
- end
- mouse.Button1Down:connect(shoot)
- --0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0
- --0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0
- --[[
- local vel = Instance.new("BodyVelocity", game.Players.LocalPlayer.Character.UpperTorso)
- vel.Velocity = game.Players.LocalPlayer.Character.UpperTorso.CFrame.lookVector * -5
- vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- --]]
- --By Rufus14 (FINALLY I KNOW HOW TO MAKE A RAGDOLL :D)
- --die plz
- mouse = game.Players.LocalPlayer:GetMouse()
- function ragdoll()
- game.Players.LocalPlayer.Character.Archivable = true
- clone = game.Players.LocalPlayer.Character:Clone()
- clone.Parent = workspace
- for i,v in pairs(clone:GetChildren()) do
- if v.ClassName == "Script" or v.ClassName == "LocalScript" then
- v:destroy()
- end
- for i,p in pairs(v:GetChildren()) do
- if p.ClassName == "Weld" or p.ClassName == "Motor6D" or p.ClassName == "BodyVelocity" then
- p:destroy()
- end
- end
- end
- for i,t in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
- if t.ClassName == "Accessory" or t.ClassName == "ForceField" then
- t:destroy()
- end
- end
- vel = Instance.new("BodyVelocity", clone.UpperTorso)
- vel.Velocity = clone.UpperTorso.CFrame.lookVector * -5
- vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- clone.Head.face.Texture = "http://www.roblox.com/asset/?id=161061608"
- using = false
- hit = Instance.new("Sound", clone.UpperTorso)
- hit.SoundId = "rbxassetid://260430060"
- hit.Volume = 5
- hit1 = Instance.new("Sound", clone.UpperTorso)
- hit1.SoundId = "rbxassetid://138087186"
- hit1.Volume = 5
- hit2 = Instance.new("Sound", clone.UpperTorso)
- hit2.SoundId = "rbxassetid://131237241"
- hit2.Volume = 5
- hit3 = Instance.new("Sound", clone.UpperTorso)
- hit3.SoundId = "rbxassetid://278062209"
- hit3.Volume = 5
- hit3.TimePosition = 0.33
- ded = Instance.new("Sound", clone.UpperTorso)
- ded.SoundId = "rbxassetid://418892870"
- ded.Volume = 5
- local leftarm = clone:findFirstChild("LeftUpperArm")
- local rightrm = clone:findFirstChild("RightUpperArm")
- local leftleg = clone:findFirstChild("LeftUpperLeg")
- local rightleg = clone:findFirstChild("RightUpperLeg")
- local head = clone:findFirstChild("Head")
- for i, g in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
- if g.ClassName == "Part" then
- g:destroy()
- end
- end
- for i, h in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
- if h.ClassName == "Accesory" then
- h:destroy()
- end
- end
- game.Workspace.CurrentCamera.CameraSubject = head
- if head ~= nil then
- local glue13 = Instance.new("Glue", clone.UpperTorso)
- glue13.Part0 = clone.UpperTorso
- glue13.Part1 = head
- glue13.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
- glue13.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
- local collider13 = Instance.new("Part", head)
- collider13.Position = Vector3.new(0,999,0)
- collider13.Size = Vector3.new(0.5, 0.9, 0.9)
- collider13.Shape = "Cylinder"
- collider13.Transparency = 1
- local weld = Instance.new("Weld", collider13)
- weld.Part0 = head
- weld.Part1 = collider13
- weld.C0 = weld.C0 * CFrame.new(0,0.2,0) * CFrame.Angles(0, 0, 80)
- collider13.TopSurface = "Smooth"
- collider13.BottomSurface = "Smooth"
- collider13.formFactor = "Symmetric"
- end
- if leftleg ~= nil then
- local glue = Instance.new("Glue", clone.UpperTorso)
- glue.Part0 = clone.UpperTorso
- glue.Part1 = leftleg
- glue.Name = "LeftUpperLeg"
- local collider = Instance.new("Part", leftleg)
- collider.Position = Vector3.new(0,999,0)
- collider.Size = Vector3.new(1.7, 1, 1)
- collider.Shape = "Cylinder"
- local weld = Instance.new("Weld", collider)
- weld.Part0 = leftleg
- weld.Part1 = collider
- weld.C0 = CFrame.Angles(0, 0, 80)
- collider.TopSurface = "Smooth"
- collider.BottomSurface = "Smooth"
- collider.formFactor = "Symmetric"
- glue.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- glue.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- collider.Transparency = 1
- end
- ------------
- if rightleg ~= nil then
- local glue1 = Instance.new("Glue", clone.UpperTorso)
- glue1.Part0 = clone.UpperTorso
- glue1.Part1 = rightleg
- glue1.Name = "RightUpperLeg"
- local collider1 = Instance.new("Part", rightleg)
- collider1.Position = Vector3.new(0,999,0)
- collider1.Size = Vector3.new(1.7, 1, 1)
- collider1.Shape = "Cylinder"
- local weld1 = Instance.new("Weld", collider1)
- weld1.Part0 = rightleg
- weld1.Part1 = collider1
- weld1.C0 = CFrame.Angles(0, 0, 80)
- collider1.TopSurface = "Smooth"
- collider1.BottomSurface = "Smooth"
- collider1.formFactor = "Symmetric"
- glue1.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- glue1.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- collider1.Transparency = 1
- end
- ------------
- if rightrm ~= nil then
- local glue11 = Instance.new("Glue", clone.UpperTorso)
- glue11.Part0 = clone.UpperTorso
- glue11.Part1 = rightrm
- glue11.Name = "Right shoulder"
- local collider11 = Instance.new("Part", rightrm)
- collider11.Position = Vector3.new(0,9999,0)
- collider11.Size = Vector3.new(1.8,1,1)
- collider11.Shape = "Cylinder"
- local weld11 = Instance.new("Weld", collider11)
- weld11.Part0 = rightrm
- weld11.Part1 = collider11
- weld11.C0 = CFrame.Angles(0, 0, 80)
- collider11.TopSurface = "Smooth"
- collider11.BottomSurface = "Smooth"
- collider11.formFactor = "Symmetric"
- glue11.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- glue11.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- collider11.Transparency = 1
- end
- ------------
- if leftarm ~= nil then
- local glue111 = Instance.new("Glue", clone.UpperTorso)
- glue111.Part0 = clone.UpperTorso
- glue111.Part1 = leftarm
- glue111.Name = "Left shoulder"
- local collider111 = Instance.new("Part", leftarm)
- collider111.Position = Vector3.new(0,9999,0)
- collider111.Size = Vector3.new(1.8,1,1)
- collider111.Shape = "Cylinder"
- local weld111 = Instance.new("Weld", collider111)
- weld111.Part0 = leftarm
- weld111.Part1 = collider111
- weld111.C0 = CFrame.Angles(0, 0, 80)
- collider111.TopSurface = "Smooth"
- collider111.BottomSurface = "Smooth"
- collider111.formFactor = "Symmetric"
- glue111.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- glue111.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- collider111.Transparency = 1
- ----------------
- sensoring = Instance.new("Part", clone.UpperTorso)
- sensoring.Size = Vector3.new(1.2,1.1,0.8)
- sensoring.CanCollide = false
- sensoring.Position = clone.UpperTorso.Position
- local welder = Instance.new("Weld", sensoring)
- welder.Part0 = clone.UpperTorso
- welder.Part1 = sensoring
- welder.C0 = welder.C0 * CFrame.new(0,0,1.05)
- sensoring.Transparency = 1
- -----------------
- sensoring1 = Instance.new("Part", clone.UpperTorso)
- sensoring1.Size = Vector3.new(1.2,1.1,0.8)
- sensoring1.CanCollide = false
- sensoring1.Position = clone.UpperTorso.Position
- local welder1 = Instance.new("Weld", sensoring)
- welder1.Part0 = clone.UpperTorso
- welder1.Part1 = sensoring1
- welder1.C0 = welder1.C0 * CFrame.new(0,0,-1.05)
- sensoring1.Transparency = 1
- end
- clone.Name = game.Players.LocalPlayer.Character.Name.."Got Dominated","Got Killed","Got Memed","Got Ded","Got RIPPED apart","Got OOFED Apart ","Got Trolled","Got? Who died","Got destroyed "
- ded:Play()
- vel:destroy()
- wait(0.5)
- local function touch()
- if not using then
- using = true
- local Math = math.random(1,4)
- if Math == 1 then
- hit:Play()
- end
- if Math == 2 then
- hit1:Play()
- end
- if Math == 3 then
- hit2:Play()
- end
- if Math == 4 then
- hit3:Play()
- end
- wait(0.1)
- using = false
- end
- end
- sensoring.Touched:connect(touch)
- sensoring1.Touched:connect(touch)
- wait(4.47)
- hit1.Volume = 0
- hit2.Volume = 0
- hit3.Volume = 0
- hit.Volume = 0
- end
- game.Players.LocalPlayer.Character.Humanoid.Died:connect(ragdoll)
- while true do
- wait(0.01)
- gun.BrickColor = BrickColor.Black()
- end
- --di ent
- HUMANOID = game.Players.LocalPlayer.Character.Humanoid
- wait()
- if HUMANOID.RigType ~= Enum.HumanoidRigType.R15 then
- game.Debris:AddItem(script,1)
- else
- local character = game.Players.LocalPlayer.Character
- 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(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(attachmentName)
- for _,child in next,character:GetChildren() do
- local attachment = child:FindFirstChild(attachmentName)
- if attachment then
- return attachment
- end
- end
- end
- HUMANOID.Died:connect(function()
- local camera = workspace.CurrentCamera
- if camera.CameraSubject == character.Humanoid then--If developer isn't controlling camera
- camera.CameraSubject = character.UpperTorso
- end
- --Make it so ragdoll can't collide with invisible HRP, but don't let HRP fall through map and be destroyed in process
- character.HumanoidRootPart.Anchored = true
- character.HumanoidRootPart.CanCollide = false
- --Helps to fix constraint spasms
- 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)
- for _,child in next,character:GetChildren() do
- if child:IsA("Accoutrement") then
- for _,part in next,child:GetChildren() do
- if part:IsA("BasePart") then
- part.Parent = character
- child:remove()
- local attachment1 = part:FindFirstChildOfClass("Attachment")
- local attachment0 = getAttachment0(attachment1.Name)
- if attachment0 and attachment1 then
- local constraint = Instance.new("HingeConstraint")
- constraint.Attachment0 = attachment0
- constraint.Attachment1 = attachment1
- constraint.LimitsEnabled = true
- constraint.UpperAngle = 0
- constraint.LowerAngle = 0
- constraint.Parent = character
- end
- end
- end
- end
- end
- ragdollJoint(character.LowerTorso, character.UpperTorso, "Waist", "BallSocket", {
- {"LimitsEnabled",true};
- {"UpperAngle",5};
- })
- ragdollJoint(character.UpperTorso, character.Head, "Neck", "BallSocket", {
- {"LimitsEnabled",true};
- {"UpperAngle",15};
- })
- local handProperties = {
- {"LimitsEnabled", true};
- {"UpperAngle",0};
- {"LowerAngle",0};
- }
- ragdollJoint(character.LeftLowerArm, character.LeftHand, "LeftWrist", "Hinge", handProperties)
- ragdollJoint(character.RightLowerArm, character.RightHand, "RightWrist", "Hinge", handProperties)
- local shinProperties = {
- {"LimitsEnabled", true};
- {"UpperAngle", 0};
- {"LowerAngle", -75};
- }
- ragdollJoint(character.LeftUpperLeg, character.LeftLowerLeg, "LeftKnee", "Hinge", shinProperties)
- ragdollJoint(character.RightUpperLeg, character.RightLowerLeg, "RightKnee", "Hinge", shinProperties)
- local footProperties = {
- {"LimitsEnabled", true};
- {"UpperAngle", 15};
- {"LowerAngle", -45};
- }
- ragdollJoint(character.LeftLowerLeg, character.LeftFoot, "LeftAnkle", "Hinge", footProperties)
- ragdollJoint(character.RightLowerLeg, character.RightFoot, "RightAnkle", "Hinge", footProperties)
- --TODO fix ability for socket to turn backwards whenn ConeConstraints are shipped
- ragdollJoint(character.UpperTorso, character.LeftUpperArm, "LeftShoulder", "BallSocket")
- ragdollJoint(character.LeftUpperArm, character.LeftLowerArm, "LeftElbow", "BallSocket")
- ragdollJoint(character.UpperTorso, character.RightUpperArm, "RightShoulder", "BallSocket")
- ragdollJoint(character.RightUpperArm, character.RightLowerArm, "RightElbow", "BallSocket")
- ragdollJoint(character.LowerTorso, character.LeftUpperLeg, "LeftHip", "BallSocket")
- ragdollJoint(character.LowerTorso, character.RightUpperLeg, "RightHip", "BallSocket")
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement