I’m trying to achieve the player standing upright after getting up from ragdoll, because it may glitch out when the player is trying to stand up after recovering from ragdoll. I’ve tried bodygyros, but don’t really know how they work. I have also tried disabling the fallingdown and Ragdoll statetypes to make them get up instantly, but that doesn’t work either… Any way I can achieve this?
Here’s the ragdoll code
function createjoint(parent,jointtype)
local joint = script.Part[jointtype]:clone()
joint.Parent = parent
joint.Name = joint.Parent.Name.."Joint"
local connector = script.Connector:Clone()
connector.Parent = joint.Parent.Parent.Torso
connector.Attachment0 = joint.Parent.Parent.Torso:FindFirstChild(joint.Name)
connector.Attachment1 = joint
local eh = Instance.new("IntValue")
eh.Name = "ExtraJoint"
eh.Parent = joint
local eh2 = eh:Clone()
eh2.Parent = connector
end
local character = char
spawn(function()
wait()
plr.Character.Parent = game.Workspace.Players
for i,v in pairs(script.Torso:GetChildren()) do
if v.ClassName == "Attachment" then
v.Parent = character.Torso
end
end
createjoint(character["Right Arm"],"ArmJoint")
wait()
createjoint(character["Left Arm"],"ArmJoint")
wait()
createjoint(character["Right Leg"],"LegJoint")
wait()
createjoint(character["Left Leg"],"LegJoint")
wait()
end)
local hum = char:WaitForChild('Humanoid')
local par = hum.Parent
local Motors = {char.Torso:FindFirstChild("Left Hip"),char.Torso:FindFirstChild("Left Shoulder"),char.Torso:FindFirstChild("Right Hip"),char.Torso:FindFirstChild("Right Shoulder")}
local BIGBOYJOINT = char.HumanoidRootPart.RootJoint
local VALUEe = Instance.new("BoolValue")
VALUEe.Name = "Stun"
function Ragdoll()
char.HumanoidRootPart.Anchored = false
VALUEe.Parent = char.StatusEffects
for i,v in pairs(char:GetChildren()) do
if v:IsA("BasePart") then
local F = v:Clone()
F:ClearAllChildren()
F.Size = Vector3.new(1,1,.5)
F.Parent = v
F.Transparency = 1
F.Name = "Joint"
F.CanCollide = true
local WELD = Instance.new("Weld",F)
WELD.Part0 = F
WELD.Part1 = v
end
end
hum.PlatformStand = true
hum.AutoRotate = false
--BIGBOYJOINT.Parent = nil
for i = 1, #Motors do
if Motors[i].ClassName == "Motor6D" then
Motors[i].Parent = nil
end
end
end
function UnRagdoll()
char.HumanoidRootPart.CFrame = char.Torso.CFrame
BIGBOYJOINT.Parent = char.HumanoidRootPart
VALUEe.Parent = nil
for i,v in pairs(char:GetDescendants()) do
if v:IsA("BasePart") then
if v.Name == "Joint" then
v:Destroy()
end
end
end
hum.PlatformStand = false
hum.AutoRotate = true
for i = 1, #Motors do
if Motors[i].ClassName == "Motor6D" then
Motors[i].Parent = char.Torso
end
end
end
humanoid.StateChanged:Connect(function(old, new)
if new == Enum.HumanoidStateType.Ragdoll then
humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
end
end)
I think I have already disabled it in this script:
game.Players.PlayerAdded:connect(function(player) --Fires when you join the server
local plr = player
player.CharacterAdded:connect(function(character) --Makes it so when your character spawns the event fires
wait(.2)
local stateType = Enum.HumanoidStateType
local humanoid = character:WaitForChild("Humanoid")
humanoid:SetStateEnabled(stateType.FallingDown, false)
humanoid:SetStateEnabled(stateType.Ragdoll, false)
end)
end)
Still having the issue.
This is the kind of issue I am facing, and moving the camera with shift lock can also bring this flinging result: https://gyazo.com/fdec49cad0f48fd9d3bbd132ac9e6771
Here’s the code that sets the state to standing up, the changestate is in UnRagdoll()
wait(2)
local plr = script.Parent.Parent
local char = plr.Character
local target = workspace.Rigs.warycoolio.HumanoidRootPart
local player = char.HumanoidRootPart
function createjoint(parent,jointtype)
local joint = script.Part[jointtype]:clone()
joint.Parent = parent
joint.Name = joint.Parent.Name.."Joint"
local connector = script.Connector:Clone()
connector.Parent = joint.Parent.Parent.Torso
connector.Attachment0 = joint.Parent.Parent.Torso:FindFirstChild(joint.Name)
connector.Attachment1 = joint
local eh = Instance.new("IntValue")
eh.Name = "ExtraJoint"
eh.Parent = joint
local eh2 = eh:Clone()
eh2.Parent = connector
end
local character = char
spawn(function()
wait()
plr.Character.Parent = game.Workspace.Players
for i,v in pairs(script.Torso:GetChildren()) do
if v.ClassName == "Attachment" then
v.Parent = character.Torso
end
end
createjoint(character["Right Arm"],"ArmJoint")
wait()
createjoint(character["Left Arm"],"ArmJoint")
wait()
createjoint(character["Right Leg"],"LegJoint")
wait()
createjoint(character["Left Leg"],"LegJoint")
wait()
end)
local hum = char:WaitForChild('Humanoid')
local par = hum.Parent
local Motors = {char.Torso:FindFirstChild("Left Hip"),char.Torso:FindFirstChild("Left Shoulder"),char.Torso:FindFirstChild("Right Hip"),char.Torso:FindFirstChild("Right Shoulder")}
local BIGBOYJOINT = char.HumanoidRootPart.RootJoint
local VALUEe = Instance.new("BoolValue")
VALUEe.Name = "Stun"
function Ragdoll()
char.HumanoidRootPart.Anchored = false
VALUEe.Parent = char.StatusEffects
for i,v in pairs(char:GetChildren()) do
if v:IsA("BasePart") then
local F = v:Clone()
F:ClearAllChildren()
F.Size = Vector3.new(1,1,.5)
F.Parent = v
F.Transparency = 1
F.Name = "Joint"
F.CanCollide = true
local WELD = Instance.new("Weld",F)
WELD.Part0 = F
WELD.Part1 = v
end
end
hum.PlatformStand = true
hum.AutoRotate = false
--BIGBOYJOINT.Parent = nil
for i = 1, #Motors do
if Motors[i].ClassName == "Motor6D" then
Motors[i].Parent = nil
end
end
end
function UnRagdoll()
char.HumanoidRootPart.CFrame = char.Torso.CFrame
BIGBOYJOINT.Parent = char.HumanoidRootPart
VALUEe.Parent = nil
for i,v in pairs(char:GetDescendants()) do
if v:IsA("BasePart") then
if v.Name == "Joint" then
v:Destroy()
end
end
end
hum.PlatformStand = false
hum.AutoRotate = true
hum:ChangeState(Enum.HumanoidStateType.GettingUp)
for i = 1, #Motors do
if Motors[i].ClassName == "Motor6D" then
Motors[i].Parent = char.Torso
end
end
end
local EFFECTS = char:WaitForChild("StatusEffects")
EFFECTS.ChildAdded:Connect(function(CHILD)
if CHILD.Name == "Effects" then
local EFFECTS = char:WaitForChild("StatusEffects")
end
if CHILD.Name == "Ragdoll" then
hum:UnequipTools()
Ragdoll()
end
end)
EFFECTS.ChildRemoved:Connect(function(CHILD)
if CHILD.Name == "Ragdoll" then
if EFFECTS:FindFirstChild("Ragdoll") == nil then
UnRagdoll()
end
end
end)
plr.Character.ChildAdded:connect(function(child)
if char.StatusEffects:FindFirstChild("Ragdoll") and child.ClassName == "Tool" then
hum:UnequipTools()
end
end)
To fix this, would I disable collisions on the legs and arms? I don’t know how to make it fix the arms and legs up. Also for the code part, I will be renaming some of the variables and make it more understandable shortly.
How would I go about doing this? I fixed the arms flailing around by keeping the joints cancollide on, but it still brings me the getting up issue. Here’s the code.
wait(2)
local plr = script.Parent.Parent
local char = plr.Character
local target = workspace.Rigs.warycoolio.HumanoidRootPart
local player = char.HumanoidRootPart
function createjoint(parent,jointtype)
local joint = script.Part[jointtype]:clone()
joint.Parent = parent
joint.Name = joint.Parent.Name.."Joint"
local connector = script.Connector:Clone()
connector.Parent = joint.Parent.Parent.Torso
connector.Attachment0 = joint.Parent.Parent.Torso:FindFirstChild(joint.Name)
connector.Attachment1 = joint
local ExtraJoint = Instance.new("IntValue")
ExtraJoint.Name = "ExtraJoint"
ExtraJoint.Parent = joint
local ExtraJointClone = ExtraJoint:Clone()
ExtraJointClone.Parent = connector
end
local character = char
spawn(function()
wait()
plr.Character.Parent = game.Workspace.Players
for i,v in pairs(script.Torso:GetChildren()) do
if v.ClassName == "Attachment" then
v.Parent = character.Torso
end
end
createjoint(character["Right Arm"],"ArmJoint")
wait()
createjoint(character["Left Arm"],"ArmJoint")
wait()
createjoint(character["Right Leg"],"LegJoint")
wait()
createjoint(character["Left Leg"],"LegJoint")
wait()
end)
local hum = char:WaitForChild('Humanoid')
local par = hum.Parent
local Motors = {char.Torso:FindFirstChild("Left Hip"),char.Torso:FindFirstChild("Left Shoulder"),char.Torso:FindFirstChild("Right Hip"),char.Torso:FindFirstChild("Right Shoulder")}
local BIGBOYJOINT = char.HumanoidRootPart.RootJoint
local VALUEe = Instance.new("BoolValue")
VALUEe.Name = "Stun"
function Ragdoll()
char.HumanoidRootPart.Anchored = false
VALUEe.Parent = char.StatusEffects
for i,v in pairs(char:GetChildren()) do
if v:IsA("BasePart") then
local partclone = v:Clone()
v.CanCollide = false
partclone:ClearAllChildren()
partclone.Size = Vector3.new(1,1,.5)
partclone.Parent = v
partclone.Transparency = 1
partclone.Name = "Joint"
partclone.CanCollide = true
local WELD = Instance.new("Weld",partclone)
WELD.Part0 = partclone
WELD.Part1 = v
end
end
hum.PlatformStand = true
hum.AutoRotate = false
--BIGBOYJOINT.Parent = nil
for i = 1, #Motors do
if Motors[i].ClassName == "Motor6D" then
Motors[i].Enabled = false
--Motors[i].Parent = nil
end
end
end
function UnRagdoll()
char.HumanoidRootPart.CFrame = char.Torso.CFrame
BIGBOYJOINT.Parent = char.HumanoidRootPart
VALUEe.Parent = nil
for i,v in pairs(char:GetDescendants()) do
if v:IsA("BasePart") then
v.CanCollide = true
if v.Name == "Joint" then
v:Destroy()
end
end
end
hum.PlatformStand = false
hum.AutoRotate = true
hum:ChangeState(Enum.HumanoidStateType.GettingUp)
for i = 1, #Motors do
if Motors[i].ClassName == "Motor6D" then
--Motors[i].Parent = char.Torso
Motors[i].Enabled = true
end
end
end
humanoid.StateChanged:Connect(function(old, new)
if new == Enum.HumanoidStateType.Ragdoll then
humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
end
end)