Advertisement
4zx16

Press R to Ragdoll (R6) (Main)

Nov 22nd, 2021 (edited)
1,173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.40 KB | None | 0 0
  1. --[[
  2.  || 📜 AUTHOR: @4zx16 || PRESS R TO RAGDOLL (R6) ||  DON'T TOUCH UNLESS U KNOW WHAT UR DOING
  3. ]]
  4. wait(.3)
  5. local Player = game.Players:FindFirstChild(script.Parent.Name)  
  6.  
  7.  
  8. local Mouse,mouse,UserInputService,ContextActionService
  9. do
  10.     script.Parent = Player.Character
  11.     local CAS = {Actions={}}
  12.     local Event = Instance.new("RemoteEvent")
  13.     Event.Name = "UserInput_Event"
  14.     Event.Parent = Player.Character
  15.     local fakeEvent = function()
  16.         local t = {_fakeEvent=true}
  17.         t.Connect = function(self,f)self.Function=f end
  18.         t.connect = t.Connect
  19.         return t
  20.     end
  21.     local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  22.     local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  23.     function CAS:BindAction(name,fun,touch,...)
  24.         CAS.Actions[name] = {Name=name,Function=fun,Keys={...}}
  25.     end
  26.     function CAS:UnbindAction(name)
  27.         CAS.Actions[name] = nil
  28.     end
  29.     local function te(self,ev,...)
  30.         local t = m[ev]
  31.         if t and t._fakeEvent and t.Function then
  32.             t.Function(...)
  33.         end
  34.     end
  35.     m.TrigEvent = te
  36.     UIS.TrigEvent = te
  37.     Event.OnServerEvent:Connect(function(plr,io)
  38.         if plr~=Player then return end
  39.         if io.isMouse then
  40.             m.Target = io.Target
  41.             m.Hit = io.Hit
  42.         elseif io.UserInputType == Enum.UserInputType.MouseButton1 then
  43.             if io.UserInputState == Enum.UserInputState.Begin then
  44.                 m:TrigEvent("Button1Down")
  45.             else
  46.                 m:TrigEvent("Button1Up")
  47.             end
  48.         else
  49.             for n,t in pairs(CAS.Actions) do
  50.                 for _,k in pairs(t.Keys) do
  51.                     if k==io.KeyCode then
  52.                         t.Function(t.Name,io.UserInputState,io)
  53.                     end
  54.                 end
  55.             end
  56.             if io.UserInputState == Enum.UserInputState.Begin then
  57.                 m:TrigEvent("KeyDown",io.KeyCode.Name:lower())
  58.                 UIS:TrigEvent("InputBegan",io,false)
  59.             else
  60.                 m:TrigEvent("KeyUp",io.KeyCode.Name:lower())
  61.                 UIS:TrigEvent("InputEnded",io,false)
  62.             end
  63.         end
  64.     end)
  65.     Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  66. end
  67.  
  68. using = false
  69. ragdolling = false
  70. hit = Instance.new("Sound", Player.Character.Torso)
  71. hit.SoundId = "rbxassetid://260430060"
  72. hit.Volume = 5
  73. hit1 = Instance.new("Sound", Player.Character.Torso)
  74. hit1.SoundId = "rbxassetid://138087186"
  75. hit1.Volume = 5
  76. hit2 = Instance.new("Sound", Player.Character.Torso)
  77. hit2.SoundId = "rbxassetid://131237241"
  78. hit2.Volume = 5
  79. hit3 = Instance.new("Sound", Player.Character.Torso)
  80. hit3.SoundId = "rbxassetid://278062209"
  81. hit3.Volume = 5
  82. hit3.TimePosition = 0.33
  83. hit4 = Instance.new("Sound", Player.Character.Torso)
  84. hit4.SoundId = "rbxassetid://429400881"
  85. hit4.Volume = 5
  86.  
  87. print("Press R to ragdollify.")
  88.  
  89. mouse.KeyDown:connect(function(key)
  90.     key = key:lower()
  91.     if key == "r" and ragdolling == false then
  92.  
  93.         ragdolling = true
  94.         local light = Instance.new("SpotLight", Player.Character.Torso)
  95.         Player.Character.Humanoid.PlatformStand = true
  96.         lshclone = Player.Character.Torso["Left Shoulder"]:Clone()
  97.         rshclone = Player.Character.Torso["Right Shoulder"]:Clone()
  98.         lhclone = Player.Character.Torso["Left Hip"]:Clone()
  99.         rhclone = Player.Character.Torso["Right Hip"]:Clone()
  100.         local leftarm = Player.Character["Left Arm"]
  101.         local rightrm = Player.Character["Right Arm"]
  102.         local leftleg = Player.Character["Left Leg"]
  103.         local rightleg = Player.Character["Right Leg"]
  104.         Player.Character.Torso["Left Hip"]:destroy()
  105.         local head = Player.Character.Head
  106.         glue = Instance.new("Glue", Player.Character.Torso)
  107.         glue.Part0 = Player.Character.Torso
  108.         glue.Part1 = leftleg
  109.         glue.Name = "Left leg"
  110.         collider = Instance.new("Part", leftleg)
  111.         collider.Position = Vector3.new(0,999,0)
  112.         collider.Size = Vector3.new(1.5, 1, 1)
  113.         collider.Shape = "Cylinder"
  114.         local weld = Instance.new("Weld", collider)
  115.         weld.Part0 = leftleg
  116.         weld.Part1 = collider
  117.         weld.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
  118.         collider.TopSurface = "Smooth"
  119.         collider.BottomSurface = "Smooth"
  120.         collider.formFactor = "Symmetric"
  121.         glue.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  122.         glue.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  123.         collider.Transparency = 1
  124.         ------------
  125.         Player.Character.Torso["Right Hip"]:destroy()
  126.         glue1 = Instance.new("Glue", Player.Character.Torso)
  127.         glue1.Part0 = Player.Character.Torso
  128.         glue1.Part1 = rightleg
  129.         glue1.Name = "Right leg"
  130.         collider1 = Instance.new("Part", rightleg)
  131.         collider1.Position = Vector3.new(0,9999,0)
  132.         collider1.Size = Vector3.new(1.5, 1, 1)
  133.         collider1.Shape = "Cylinder"
  134.         local weld1 = Instance.new("Weld", collider1)
  135.         weld1.Part0 = rightleg
  136.         weld1.Part1 = collider1
  137.         weld1.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
  138.         collider1.TopSurface = "Smooth"
  139.         collider1.BottomSurface = "Smooth"
  140.         collider1.formFactor = "Symmetric"
  141.         glue1.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  142.         glue1.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  143.         collider1.Transparency = 1
  144.         ------------
  145.         Player.Character.Torso["Right Shoulder"]:destroy()
  146.         glue11 = Instance.new("Glue", Player.Character.Torso)
  147.         glue11.Part0 = Player.Character.Torso
  148.         glue11.Part1 = rightrm
  149.         glue11.Name = "Right shoulder"
  150.         collider11 = Instance.new("Part", rightrm)
  151.         collider11.Position = Vector3.new(0,9999,0)
  152.         collider11.Size = Vector3.new(1.8,1,1)
  153.         collider11.Shape = "Cylinder"
  154.         local weld11 = Instance.new("Weld", collider11)
  155.         weld11.Part0 = rightrm
  156.         weld11.Part1 = collider11
  157.         weld11.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
  158.         collider11.TopSurface = "Smooth"
  159.         collider11.BottomSurface = "Smooth"
  160.         collider11.formFactor = "Symmetric"
  161.         glue11.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  162.         glue11.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  163.         collider11.Transparency = 1
  164.         ------------
  165.         Player.Character.Torso["Left Shoulder"]:destroy()
  166.         glue111 = Instance.new("Glue", Player.Character.Torso)
  167.         glue111.Part0 = Player.Character.Torso
  168.         glue111.Part1 = leftarm
  169.         glue111.Name = "Left shoulder"
  170.         collider111 = Instance.new("Part", leftarm)
  171.         collider111.Position = Vector3.new(0,9999,0)
  172.         collider111.Size = Vector3.new(1.5, 1, 1)
  173.         collider111.Shape = "Cylinder"
  174.         local weld111 = Instance.new("Weld", collider111)
  175.         weld111.Part0 = leftarm
  176.         weld111.Part1 = collider111
  177.         weld111.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
  178.         collider111.TopSurface = "Smooth"
  179.         collider111.BottomSurface = "Smooth"
  180.         collider111.formFactor = "Symmetric"
  181.         glue111.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  182.         glue111.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  183.         collider111.Transparency = 1
  184.         -----------------
  185.         sensoring = Instance.new("Part", Player.Character.Torso)
  186.         sensoring.Size = Vector3.new(1.2,1.1,0.8)
  187.         sensoring.CanCollide = false
  188.         sensoring.Position = Player.Character.Torso.Position
  189.         local welder = Instance.new("Weld", sensoring)
  190.         welder.Part0 = Player.Character.Torso
  191.         welder.Part1 = sensoring
  192.         welder.C0 = welder.C0 * CFrame.new(0,0,1.05)
  193.         sensoring.Transparency = 1
  194.         -----------------
  195.         sensoring1 = Instance.new("Part", Player.Character.Torso)
  196.         sensoring1.Size = Vector3.new(1.2,1.1,0.8)
  197.         sensoring1.CanCollide = false
  198.         sensoring1.Position = Player.Character.Torso.Position
  199.         local welder1 = Instance.new("Weld", sensoring)
  200.         welder1.Part0 = Player.Character.Torso
  201.         welder1.Part1 = sensoring1
  202.         welder1.C0 = welder1.C0 * CFrame.new(0,0,-1.05)
  203.         sensoring1.Transparency = 1
  204.  
  205.         local function touch()
  206.             if not using then
  207.                 using = true
  208.                 local Math = math.random(1,4)
  209.                 if Math == 1 then
  210.                     hit:Play()
  211.                 end
  212.                 if Math == 2 then
  213.                     hit1:Play()
  214.                 end
  215.                 if Math == 3 then
  216.                     hit2:Play()
  217.                 end
  218.                 if Math == 4 then
  219.                     hit3:Play()
  220.                 end
  221.                 wait(0.1)
  222.                 using = false
  223.             end
  224.         end
  225.         sensoring.Touched:connect(touch)
  226.         sensoring1.Touched:connect(touch)
  227.     elseif key == 'r' and ragdolling == true then
  228.         ragdolling = false
  229.         lshclone.Parent = Player.Character.Torso
  230.         glue:destroy()
  231.         rshclone.Parent = Player.Character.Torso
  232.         glue1:destroy()
  233.         lhclone.Parent = Player.Character.Torso
  234.         glue11:destroy()
  235.         rhclone.Parent = Player.Character.Torso
  236.         glue111:destroy()
  237.         collider:destroy()
  238.         collider1:destroy()
  239.         collider11:destroy()
  240.         collider111:destroy()
  241.         sensoring:destroy()
  242.         sensoring1:destroy()
  243.         Player.Character.Torso.SpotLight:destroy()
  244.         Player.Character.Humanoid.PlatformStand = false
  245.         Player.Character.Humanoid.Jump = true
  246.     end
  247. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement