Advertisement
Guest User

R6 script

a guest
Aug 20th, 2023
32,367
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.08 KB | None | 1 0
  1. -- RAGDOLL FOR R6
  2.  
  3. local function getAttachment0(attachmentName, char)
  4. for _,child in next,char:GetChildren() do
  5. local attachment = child:FindFirstChild(attachmentName)
  6. if attachment then
  7. return attachment
  8. end
  9. end
  10. end
  11.  
  12. local function ragdollPlayer(char)
  13. local head = char["Head"]
  14. local hum = char:WaitForChild("Humanoid")
  15. local leftarm = char["Left Arm"]
  16. local leftleg = char["Left Leg"]
  17. local rightleg = char["Right Leg"]
  18. local rightarm = char["Right Arm"]
  19. local torso = char.Torso
  20. hum.PlatformStand = true
  21. local root =char:FindFirstChild("HumanoidRootPart")
  22. if root ~= nil then
  23. root:Destroy()
  24. end
  25. local rootA =Instance.new("Attachment")
  26. local HeadA = Instance.new("Attachment")
  27. local LeftArmA = Instance.new("Attachment")
  28. local LeftLegA = Instance.new("Attachment")
  29. local RightArmA = Instance.new("Attachment")
  30. local RightLegA = Instance.new("Attachment")
  31. local TorsoA = Instance.new("Attachment")
  32. local TorsoA1 = Instance.new("Attachment")
  33. local TorsoA2 = Instance.new("Attachment")
  34. local TorsoA3 = Instance.new("Attachment")
  35. local TorsoA4 = Instance.new("Attachment")
  36. local TorsoA5 = Instance.new("Attachment")
  37. local function set1()
  38. HeadA.Name = "HeadA"
  39. HeadA.Parent = head
  40. HeadA.Position = Vector3.new(0, -0.5, 0)
  41. HeadA.Rotation = Vector3.new(0, 0, 0)
  42. HeadA.Axis = Vector3.new(1, 0, 0)
  43. HeadA.SecondaryAxis = Vector3.new(0, 1, 0)
  44. LeftArmA.Name = "LeftArmA"
  45. LeftArmA.Parent = leftarm
  46. LeftArmA.Position = Vector3.new(0.5, 1, 0)
  47. LeftArmA.Rotation = Vector3.new(0, 0, 0)
  48. LeftArmA.Axis = Vector3.new(1, 0, 0)
  49. LeftArmA.SecondaryAxis = Vector3.new(0, 1, 0)
  50. LeftLegA.Name = "LeftLegA"
  51. LeftLegA.Parent = leftleg
  52. LeftLegA.Position = Vector3.new(0, 1, 0)
  53. LeftLegA.Rotation = Vector3.new(0, 0, 0)
  54. LeftLegA.Axis = Vector3.new(1, 0, 0)
  55. LeftLegA.SecondaryAxis = Vector3.new(0, 1, 0)
  56. RightArmA.Name = "RightArmA"
  57. RightArmA.Parent = rightarm
  58. RightArmA.Position = Vector3.new(-0.5, 1, 0)
  59. RightArmA.Rotation = Vector3.new(0, 0, 0)
  60. RightArmA.Axis = Vector3.new(1, 0, 0)
  61. RightArmA.SecondaryAxis = Vector3.new(0, 1, 0)
  62. RightLegA.Name = "RightLegA"
  63. RightLegA.Parent = rightleg
  64. RightLegA.Position = Vector3.new(0, 1, 0)
  65. RightLegA.Rotation = Vector3.new(0, 0, 0)
  66. RightLegA.Axis = Vector3.new(1, 0, 0)
  67. RightLegA.SecondaryAxis = Vector3.new(0, 1, 0)
  68. rootA.Name= "rootA"
  69. rootA.Parent = root
  70. rootA.Position = Vector3.new(0, 0, 0)
  71. rootA.Rotation = Vector3.new(0, 90, 0)
  72. rootA.Axis = Vector3.new(0, 0, -1)
  73. rootA.SecondaryAxis = Vector3.new(0, 1, 0)
  74. end
  75. local function set2()
  76. TorsoA.Name = "TorsoA"
  77. TorsoA.Parent = torso
  78. TorsoA.Position = Vector3.new(0.5, -1, 0)
  79. TorsoA.Rotation = Vector3.new(0, 0, 0)
  80. TorsoA.Axis = Vector3.new(1, 0, 0)
  81. TorsoA.SecondaryAxis = Vector3.new(0, 1, 0)
  82. TorsoA1.Name = "TorsoA1"
  83. TorsoA1.Parent = torso
  84. TorsoA1.Position = Vector3.new(-0.5, -1, 0)
  85. TorsoA1.Rotation = Vector3.new(0, 0, 0)
  86. TorsoA1.Axis = Vector3.new(1, 0, 0)
  87. TorsoA1.SecondaryAxis = Vector3.new(0, 1, 0)
  88. TorsoA2.Name = "TorsoA2"
  89. TorsoA2.Parent = torso
  90. TorsoA2.Position = Vector3.new(-1, 1, 0)
  91. TorsoA2.Rotation = Vector3.new(0, 0, 0)
  92. TorsoA2.Axis = Vector3.new(1, 0, 0)
  93. TorsoA2.SecondaryAxis = Vector3.new(0, 1, 0)
  94. TorsoA3.Name = "TorsoA3"
  95. TorsoA3.Parent = torso
  96. TorsoA3.Position = Vector3.new(1, 1, 0)
  97. TorsoA3.Rotation = Vector3.new(0, 0, 0)
  98. TorsoA3.Axis = Vector3.new(1, 0, 0)
  99. TorsoA3.SecondaryAxis = Vector3.new(0, 1, 0)
  100. TorsoA4.Name = "TorsoA4"
  101. TorsoA4.Parent = torso
  102. TorsoA4.Position = Vector3.new(0, 1, 0)
  103. TorsoA4.Rotation = Vector3.new(0, 0, 0)
  104. TorsoA4.Axis = Vector3.new(1, 0, 0)
  105. TorsoA4.SecondaryAxis = Vector3.new(0, 1, 0)
  106. TorsoA5.Name = "TorsoA5"
  107. TorsoA5.Parent = torso
  108. TorsoA5.Position = Vector3.new(0, 0, 0)
  109. TorsoA5.Rotation = Vector3.new(0, 90, 0)
  110. TorsoA5.Axis = Vector3.new(0, 0, -1)
  111. TorsoA5.SecondaryAxis = Vector3.new(0, 1, 0)
  112. end
  113. spawn(set1)
  114. spawn(set2)
  115. --[[
  116. local HA = Instance.new("HingeConstraint")
  117. HA.Parent = head
  118. HA.Attachment0 = HeadA
  119. HA.Attachment1 = TorsoA4
  120. HA.Enabled = true
  121. HA.LimitsEnabled=true
  122. HA.LowerAngle=0
  123. HA.UpperAngle=0
  124. --]]
  125. local LAT = Instance.new("BallSocketConstraint")
  126. LAT.Parent = leftarm
  127. LAT.Attachment0 = LeftArmA
  128. LAT.Attachment1 = TorsoA2
  129. LAT.Enabled = true
  130. LAT.LimitsEnabled=true
  131. LAT.UpperAngle=90
  132. local RAT = Instance.new("BallSocketConstraint")
  133. RAT.Parent = rightarm
  134. RAT.Attachment0 = RightArmA
  135. RAT.Attachment1 = TorsoA3
  136. RAT.Enabled = true
  137. RAT.LimitsEnabled=false
  138. RAT.UpperAngle=90
  139. local HA = Instance.new("BallSocketConstraint")
  140. HA.Parent = head
  141. HA.Attachment0 = HeadA
  142. HA.Attachment1 = TorsoA4
  143. HA.Enabled = true
  144. HA.LimitsEnabled = true
  145. HA.TwistLimitsEnabled = true
  146. HA.UpperAngle = 74
  147. local TLL = Instance.new("BallSocketConstraint")
  148. TLL.Parent = torso
  149. TLL.Attachment0 = TorsoA1
  150. TLL.Attachment1 = LeftLegA
  151. TLL.Enabled = true
  152. TLL.LimitsEnabled=true
  153. TLL.UpperAngle=90
  154. local TRL = Instance.new("BallSocketConstraint")
  155. TRL.Parent = torso
  156. TRL.Attachment0 = TorsoA
  157. TRL.Attachment1 = RightLegA
  158. TRL.Enabled = true
  159. TRL.LimitsEnabled=true
  160. TRL.UpperAngle=90
  161. local RTA = Instance.new("BallSocketConstraint")
  162. RTA.Parent = root
  163. RTA.Attachment0 = rootA
  164. RTA.Attachment1 = TorsoA5
  165. RTA.Enabled = true
  166. RTA.LimitsEnabled=true
  167. RTA.UpperAngle=0
  168. head.Velocity = head.CFrame.p * CFrame.new(0, -41, 0).p
  169. for _,child in next,char:GetChildren() do
  170. if child:IsA("Accoutrement") then
  171. for _,part in next,child:GetChildren() do
  172. if part:IsA("BasePart") then
  173. part.Parent = char
  174. child:remove()
  175. local attachment1 = part:FindFirstChildOfClass("Attachment")
  176. local attachment0 = getAttachment0(attachment1.Name, char)
  177. if attachment0 and attachment1 then
  178. local constraint = Instance.new("HingeConstraint")
  179. constraint.Attachment0 = attachment0
  180. constraint.Attachment1 = attachment1
  181. constraint.LimitsEnabled = true
  182. constraint.UpperAngle = 0
  183. constraint.LowerAngle = 0
  184. constraint.Parent = char
  185. end
  186. end
  187. end
  188. end
  189. end
  190. end
  191.  
  192. return ragdollPlayer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement