So the problem here is:
once i press "R" to ragdoll with my script, i start to float up and it is really weird
here is my script:
local remote = game.ReplicatedStorage.ManualRagdoll
remote.OnServerEvent:Connect(function(plr,isRagdolling)
local char = plr.Character or plr.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
local humanoidRootPart = char:WaitForChild("HumanoidRootPart")
if isRagdolling == true then
for _, v in pairs(char:GetDescendants()) do
if v:IsA("Motor6D") then
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
v.Enabled = false
local a0 = Instance.new("Attachment")
a0.CFrame = v.C0
a0.Parent = v.Part0
local a1 = Instance.new("Attachment")
a1.CFrame = v.C1
a1.Parent = v.Part1
local ballSocketConstrait = Instance.new("BallSocketConstraint")
ballSocketConstrait.Parent = v.Part0
ballSocketConstrait.Attachment0 = a0
ballSocketConstrait.Attachment1 = a1
end
end
for _, v in pairs(char:GetChildren()) do
if v:IsA("BasePart") then
if v.Name ~= "HumanoidRootPart" then
v.CanCollide = true
end
end
end
elseif isRagdolling == false then
humanoid.JumpPower = 50
humanoid.WalkSpeed = 16
for _, v in pairs(char:GetDescendants()) do
if v:IsA("BallSocketConstraint") then
v:Destroy()
end
if v:IsA("Motor6D") then
v.Enabled = true
end
for _, v in pairs(char:GetChildren()) do
if v:IsA("BasePart") then
v.CanCollide = false
end
end
end
end
end)
