-
I have a ragdoll script that launches the player after touching a part
-
The player does not get unragdolled after the amount of time, the second task.wait() never ends
-
I have tried using a coroutine, still has the same problem of the second task.wait() not passing through
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
function ragdoll.launch(ragTime,direction, strength)
print(ragTime)
if (notRagdolled) then
notRagdolled = false
for _, motor6d in ipairs(script.Parent:GetDescendants()) do
if motor6d:IsA("Motor6D") then
motor6d.Enabled = false
end
end
script.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Running, false)
script.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
headBodyJoint.Enabled = true
leftABodyJoint.Enabled = true
rightABodyJoint.Enabled = true
leftLBodyJoint.Enabled = true
rightLBodyJoint.Enabled = true
script.Parent.HumanoidRootPart.Anchored = true
task.wait()
waitTime = ragTime
local torso = script.Parent:FindFirstChild("Torso")
if torso:IsA("Part") then
torso:SetNetworkOwner(nil)
torso.AssemblyLinearVelocity = (direction.Unit * strength)
end
print("Start2")
task.wait(1)
print("Can do 1")
task.wait(ragTime)
notRagdolled = true
script.Parent:FindFirstChild("Torso"):SetNetworkOwner(player)
print("End")
script.Parent.HumanoidRootPart:PivotTo(script.Parent.Torso.CFrame)
script.Parent.HumanoidRootPart.Position = Vector3.new(script.Parent.HumanoidRootPart.Position.X,script.Parent.HumanoidRootPart.Position.Y +0.5,script.Parent.HumanoidRootPart.Position.Z)
script.Parent.HumanoidRootPart.Anchored = false
script.Parent.HumanoidRootPart.AssemblyLinearVelocity = Vector3.zero
script.Parent.HumanoidRootPart:SetNetworkOwner(nil)
script.Parent.HumanoidRootPart.AssemblyLinearVelocity = Vector3.zero
script.Parent.HumanoidRootPart:SetNetworkOwner(player)
for _, motor6d in ipairs(script.Parent:GetDescendants()) do
if motor6d:IsA("Motor6D") then
motor6d.Enabled = true
end
end
script.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Running, true)
script.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
headBodyJoint.Enabled = false
leftABodyJoint.Enabled = false
rightABodyJoint.Enabled = false
leftLBodyJoint.Enabled = false
rightLBodyJoint.Enabled = false
end
end