- **What is the issue?
The problem is I’m getting this error whenever I reset and then touch the part. But, when I first play everything works fine. The ragdoll effect still works even after the error.
I tried adding waitforchild but I encountered another error. Which is infinite yield. I tried researching but couldn’t find similar problem to mine.
When I added waitforchild in line 9.
Setup:
moduleInvoke
local ragdoll = require(script:WaitForChild("RagdollMeModuleScript2"))
local SecondPart = require(script.SecondPartB)
The error is happening in “character.Animate” line 9
ragdoll:
local module = {}
local character = script.Parent.Parent
local humanoid = character.Humanoid
function module.ragdoll()
local setEnabled = humanoid:GetState() ~= Enum.HumanoidStateType.Physics
humanoid:ChangeState(setEnabled and Enum.HumanoidStateType.Physics or Enum.HumanoidStateType.GettingUp)
character.Animate.Disabled = setEnabled
if setEnabled then
for _,v in pairs(humanoid:GetPlayingAnimationTracks()) do
v:Stop(0)
end
end
end
return module
secondPart:
local module = {}
local ragdollModule = require(script.Parent:WaitForChild("RagdollMeModuleScript2"))
local billboardGuiPart = workspace.BillboardGuiPart2
local debounce = true
function touched(part)
if debounce then
debounce = false
ragdollModule.ragdoll()
wait(4)
ragdollModule.ragdoll()
debounce = true
end
end
billboardGuiPart.Touched:Connect(touched)
return module