I want to simply change the position of body parts without using animation so that, when I make the player ragdoll, my arms and legs won’t stay in one spot or stick to each other.
I’m trying to do this, but nothing is happening.
Similar questions have been asked like this before, but none I can understand, I have been stuck on this for hours now, I really need help!
-- Module Script
local Stun = {}
local Ignore = {}
local Debris = game:GetService("Debris")
function Stun:InflictStun(Character,stunTime)
if not table.find(Ignore,Character) then
table.insert(Ignore,Character)
else
return
end
local Humanoid = Character:FindFirstChild("Humanoid")
local charName = Character.Name
Humanoid.RequiresNeck = false
for i,v in pairs(Character:GetDescendants()) do
if v:IsA("Motor6D") and v.Parent.Name ~= "HumanoidRootPart" then
local Socket = Instance.new("BallSocketConstraint")
local a1 = Instance.new("Attachment")
local a2 = Instance.new("Attachment")
a1.Parent = v.Part0
a2.Parent = v.Part1
Socket.Parent = v.Parent
Socket.Attachment0 = a1
Socket.Attachment1 = a2
a1.CFrame = v.C0
a2.CFrame = v.C1
Socket.LimitsEnabled = true
Socket.TwistLimitsEnabled = true
Debris:AddItem(v,0)
end
end
for i,v in pairs(Character:GetDescendants()) do
if v:IsA("BasePart") and v.Name == "Left Arm" or v.Name == "Left Leg" or v.Name == "Right Arm" or v.Name == "Right Leg" then
--local cover = Instance.new("Part")
--cover.Size = v.Size
--cover.Position = v.Position
--cover.Orientation = v.Orientation
--cover.Anchored = true
if v.Name == "Left Arm" then
v.CFrame = v.CFrame * CFrame.new(0.2,0,0) -- Here is where I am trying to move the stunned players arm. Nothing is happening
end
end
end
Humanoid.JumpPower = 0
Humanoid.WalkSpeed = 0
wait(stunTime)
for i,v in pairs(Character:GetDescendants()) do
for i,v in pairs(Character:GetDescendants()) do
if v:IsA("BallSocketConstraint") then
v.UpperAngle = 0
v.TwistUpperAngle = 0
v.TwistLowerAngle = 0
local Joints = Instance.new("Motor6D",v.Parent)
Joints.Part0 = v.Attachment0.Parent
Joints.Part1 = v.Attachment1.Parent
Joints.C0 = v.Attachment0.CFrame
Joints.C1 = v.Attachment1.CFrame
Debris:AddItem(v,0)
wait()
end
end
wait()
end
Humanoid.JumpPower = 50
Humanoid.WalkSpeed = 16
Humanoid.RequiresNeck = true
for i,v in pairs(Ignore) do
if v.Name == charName then
table.remove(Ignore,i)
end
end
end
return Stun