Joriangames

RAGDOLL Pressing KEY in Roblox Studio. SCRIPT

Feb 7th, 2024 (edited)
2,769
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 KB | None | 0 0
  1. -- RAGDOLL with PRESSING KEY by BLOXIANCODE youtube.com/c/BloxianCode
  2. -- Tutorial: https://youtu.be/zycVpt-ClEQ
  3.  
  4. local RagdollEvent = game.ReplicatedStorage.RagdollEvent
  5.  
  6. RagdollEvent.OnServerEvent:Connect(function(player, input)
  7.     if input == "go" then
  8.         for i, v in pairs(player.Character:GetDescendants()) do
  9.             if v:IsA("Motor6D") and v.Parent.Name ~= "HumanoidRootPart" then
  10.                 local Socket = Instance.new("BallSocketConstraint")
  11.                 local a1 = Instance.new("Attachment")
  12.                 local a2 = Instance.new("Attachment")
  13.                 a1.Parent = v.Part0
  14.                 a2.Parent = v.Part1
  15.                 Socket.Parent = v.Parent
  16.                 Socket.Attachment0 = a1
  17.                 Socket.Attachment1 = a2
  18.                 a1.CFrame = v.C0
  19.                 a2.CFrame = v.C1
  20.                 Socket.LimitsEnabled = true
  21.                 Socket.TwistLimitsEnabled = true
  22.                 v:Destroy()
  23.             end
  24.         end
  25.         player.Character.Humanoid.RequiresNeck = false
  26.         player.Character.Humanoid.Sit = true
  27.        
  28.     else
  29.        
  30.         for i,v in pairs(player.Character:GetDescendants()) do
  31.             if v:IsA("BallSocketConstraint") then
  32.                 v.UpperAngle = 0
  33.                 v.TwistUpperAngle = 0
  34.                 v.TwistLowerAngle = 0
  35.                 local Joints = Instance.new("Motor6D",v.Parent)
  36.                 Joints.Part0 = v.Attachment0.Parent
  37.                 Joints.Part1 = v.Attachment1.Parent
  38.                 Joints.C0 = v.Attachment0.CFrame
  39.                 Joints.C1 = v.Attachment1.CFrame
  40.                 v:Destroy()
  41.             end
  42.         end
  43.         player.Character.Humanoid.Sit = false
  44.     end
  45. end)
Advertisement
Add Comment
Please, Sign In to add comment