Issue with floating ragdoll : https://streamable.com/tn6k2l

basically if i jump the moment before i get ragdolled i float heres the code: local Ragdoll = {}

local ApplyModule = require(game.ServerScriptService.Modules.ApplyModule)

local immobilizedStatuses = {}

local attachmentCFrames = {
[“Neck”] = {CFrame.new(0, 1, 0, 0, -1, 0, 1, 0, -0, 0, 0, 1), CFrame.new(0, -0.5, 0, 0, -1, 0, 1, 0, -0, 0, 0, 1)},
[“Left Shoulder”] = {CFrame.new(-1.3, 0.75, 0, -1, 0, 0, 0, -1, 0, 0, 0, 1), CFrame.new(0.2, 0.75, 0, -1, 0, 0, 0, -1, 0, 0, 0, 1)},
[“Right Shoulder”] = {CFrame.new(1.3, 0.75, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.2, 0.75, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)},
[“Left Hip”] = {CFrame.new(-0.5, -1, 0, 0, 1, -0, -1, 0, 0, 0, 0, 1), CFrame.new(0, 1, 0, 0, 1, -0, -1, 0, 0, 0, 0, 1)},
[“Right Hip”] = {CFrame.new(0.5, -1, 0, 0, 1, -0, -1, 0, 0, 0, 0, 1), CFrame.new(0, 1, 0, 0, 1, -0, -1, 0, 0, 0, 0, 1)},
}

local ragdollInstanceNames = {
[“RagdollAttachment”] = true,
[“RagdollConstraint”] = true,
[“ColliderPart”] = true,
}

local function createColliderPart(part: BasePart)
if not part then return end
local rp = Instance.new(“Part”)
rp.Name = “ColliderPart”
rp.Size = part.Size/1.7
rp.Massless = true
rp.CFrame = part.CFrame
rp.Transparency = 1

local wc = Instance.new("WeldConstraint")
wc.Part0 = rp
wc.Part1 = part

wc.Parent = rp
rp.Parent = part

end

function replaceJoints(Target)
for _, motor: Motor6D in pairs(Target:GetDescendants()) do
if motor:IsA(“Motor6D”) then
if not attachmentCFrames[motor.Name] then continue end

		motor.Enabled = false;
		local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
		a0.CFrame = attachmentCFrames[motor.Name][1]
		a1.CFrame = attachmentCFrames[motor.Name][2]

		a0.Name = "RagdollAttachment"
		a1.Name = "RagdollAttachment"

		createColliderPart(motor.Part1)

		local b = Instance.new("BallSocketConstraint")
		b.Attachment0 = a0
		b.Attachment1 = a1
		b.Name = "RagdollConstraint"

		b.Radius = 0.15
		b.LimitsEnabled = true
		b.TwistLimitsEnabled = false
		b.MaxFrictionTorque = 0
		b.Restitution = 0
		b.UpperAngle = 90
		b.TwistLowerAngle = -45
		b.TwistUpperAngle = 45

		if motor.Name == "Neck" then
			b.TwistLimitsEnabled = true
			b.UpperAngle = 45
			b.TwistLowerAngle = -70
			b.TwistUpperAngle = 70
		end

		a0.Parent = motor.Part0
		a1.Parent = motor.Part1
		b.Parent = motor.Parent
	end
end

--Disable

end

function resetJoints(Target)

for _, instance in pairs(Target:GetDescendants()) do
	if ragdollInstanceNames[instance.Name] then
		instance:Destroy()
	end

	if instance:IsA("Motor6D") then
		instance.Enabled = true;
	end
end
--Enable

end

function Ragdoll.Start(Target)

if not Target:IsDescendantOf(workspace) then
	repeat task.wait() until Target:IsDescendantOf(workspace.LivingBeings or workspace.TestingDummys)
end



local Humanoid = Target:FindFirstChild("Humanoid")
--local State =  Target:WaitForChild("State")
--local RagdollV = State:FindFirstChild("RagdollV")

----if RagdollV then return end 



replaceJoints(Target)

Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
Humanoid.PlatformStand = true


if not immobilizedStatuses[Target] then
	immobilizedStatuses[Target] = {
		Stun = ApplyModule.CreateStatus2("IntValue", "Stun", Target),
		Freeze = ApplyModule.CreateStatus2("IntValue", "RagdollV", Target)
	}
end

end

function Ragdoll.End(Target)
local Humanoid = Target:FindFirstChild(“Humanoid”)

--local State =  Target:WaitForChild("State")
--local RagdollV = State:FindFirstChild("RagdollV")

--if not RagdollV.Value then return end 

resetJoints(Target)


Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, true )
Humanoid.PlatformStand = false



if immobilizedStatuses[Target] then
	for _, status in pairs(immobilizedStatuses[Target]) do
		status:Destroy()
	end
	immobilizedStatuses[Target] = nil
end

end

function Ragdoll.TempRagdoll(Target, Duration)
task.spawn(function()
Ragdoll.Start(Target)
task.wait(Duration )
Ragdoll.End(Target)
end)
end

return Ragdoll

1 Like

please put the script in ``` script ``` and don’t put a link in the title

better formating

Watch 2025-08-01 14-31-53 | Streamable


local Ragdoll = {}

local ApplyModule = require(game.ServerScriptService.Modules.ApplyModule)

local immobilizedStatuses = {}

local attachmentCFrames = {
[“Neck”] = {CFrame.new(0, 1, 0, 0, -1, 0, 1, 0, -0, 0, 0, 1), CFrame.new(0, -0.5, 0, 0, -1, 0, 1, 0, -0, 0, 0, 1)},
[“Left Shoulder”] = {CFrame.new(-1.3, 0.75, 0, -1, 0, 0, 0, -1, 0, 0, 0, 1), CFrame.new(0.2, 0.75, 0, -1, 0, 0, 0, -1, 0, 0, 0, 1)},
[“Right Shoulder”] = {CFrame.new(1.3, 0.75, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.2, 0.75, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)},
[“Left Hip”] = {CFrame.new(-0.5, -1, 0, 0, 1, -0, -1, 0, 0, 0, 0, 1), CFrame.new(0, 1, 0, 0, 1, -0, -1, 0, 0, 0, 0, 1)},
[“Right Hip”] = {CFrame.new(0.5, -1, 0, 0, 1, -0, -1, 0, 0, 0, 0, 1), CFrame.new(0, 1, 0, 0, 1, -0, -1, 0, 0, 0, 0, 1)},
}

local ragdollInstanceNames = {
[“RagdollAttachment”] = true,
[“RagdollConstraint”] = true,
[“ColliderPart”] = true,
}

local function createColliderPart(part: BasePart)
if not part then return end
local rp = Instance.new(“Part”)
rp.Name = “ColliderPart”
rp.Size = part.Size/1.7
rp.Massless = true
rp.CFrame = part.CFrame
rp.Transparency = 1

local wc = Instance.new("WeldConstraint")
wc.Part0 = rp
wc.Part1 = part

wc.Parent = rp
rp.Parent = part

end

function replaceJoints(Target)
for _, motor: Motor6D in pairs(Target:GetDescendants()) do
if motor:IsA(“Motor6D”) then
if not attachmentCFrames[motor.Name] then continue end

		motor.Enabled = false;
		local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
		a0.CFrame = attachmentCFrames[motor.Name][1]
		a1.CFrame = attachmentCFrames[motor.Name][2]

		a0.Name = "RagdollAttachment"
		a1.Name = "RagdollAttachment"

		createColliderPart(motor.Part1)

		local b = Instance.new("BallSocketConstraint")
		b.Attachment0 = a0
		b.Attachment1 = a1
		b.Name = "RagdollConstraint"

		b.Radius = 0.15
		b.LimitsEnabled = true
		b.TwistLimitsEnabled = false
		b.MaxFrictionTorque = 0
		b.Restitution = 0
		b.UpperAngle = 90
		b.TwistLowerAngle = -45
		b.TwistUpperAngle = 45

		if motor.Name == "Neck" then
			b.TwistLimitsEnabled = true
			b.UpperAngle = 45
			b.TwistLowerAngle = -70
			b.TwistUpperAngle = 70
		end

		a0.Parent = motor.Part0
		a1.Parent = motor.Part1
		b.Parent = motor.Parent
	end
end

--Disable

end

function resetJoints(Target)

for _, instance in pairs(Target:GetDescendants()) do
	if ragdollInstanceNames[instance.Name] then
		instance:Destroy()
	end

	if instance:IsA("Motor6D") then
		instance.Enabled = true;
	end
end
--Enable

end

function Ragdoll.Start(Target)

if not Target:IsDescendantOf(workspace) then
	repeat task.wait() until Target:IsDescendantOf(workspace.LivingBeings or workspace.TestingDummys)
end



local Humanoid = Target:FindFirstChild("Humanoid")
--local State =  Target:WaitForChild("State")
--local RagdollV = State:FindFirstChild("RagdollV")

----if RagdollV then return end 



replaceJoints(Target)

Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
Humanoid.PlatformStand = true


if not immobilizedStatuses[Target] then
	immobilizedStatuses[Target] = {
		Stun = ApplyModule.CreateStatus2("IntValue", "Stun", Target),
		Freeze = ApplyModule.CreateStatus2("IntValue", "RagdollV", Target)
	}
end

end

function Ragdoll.End(Target)
local Humanoid = Target:FindFirstChild(“Humanoid”)

--local State =  Target:WaitForChild("State")
--local RagdollV = State:FindFirstChild("RagdollV")

--if not RagdollV.Value then return end 

resetJoints(Target)


Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, true )
Humanoid.PlatformStand = false



if immobilizedStatuses[Target] then
	for _, status in pairs(immobilizedStatuses[Target]) do
		status:Destroy()
	end
	immobilizedStatuses[Target] = nil
end

end

function Ragdoll.TempRagdoll(Target, Duration)
task.spawn(function()
Ragdoll.Start(Target)
task.wait(Duration )
Ragdoll.End(Target)
end)
end

return Ragdoll
[/quote]