ChangeState() function no longer changes the state of the humanoid

Basically I have been making a controllable robot, which has the ability that when jumping and impacting the ground, it makes any character fly due to the force of impact

when a character is propelled by the impact I also program that the state of humanoid it changed to physics, to make the impact force more dynamic, the system works well, but after a certain time, I would say that after 1 or 3 minutes, the “ChangeState()” function no longer changes the state of the humanoid, characters are boosted, but state does not change to physics.

Here I will show 2 videos so you can see the problem better:

this video shows when the script works well

and this video shows when ChangeEstate no longer works

Many will say that it may be a problem with my scripts, but it is not, I used several programming methods, too many, I even tried to test the robot in another place, but it is a problem with the ChangeState, since even in other of my objects that use ChangeState too the same problem occurs

In this video I use an object that ragdolls the character that also uses ChangeState, at first it works but after a while it doesn’t

first video(working)

second video(not working)

If you still think that the problem is that it is poorly programmed, I will show you the scripts

local part = script.Parent
local ragdoller = require(part.Ragdoll)
local debounce = true
part.Touched:Connect(function(hit)
	
	if debounce == true and hit.Parent.Humanoid then
		debounce = false
		
		local char = hit.Parent
		local Humanoid = char.Humanoid
		
		Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
		Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
       ragdoller.RagdollCharacter(char)
	   
		wait(2)
		
		Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, true)
		Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
	  ragdoller.UnRagdollCharacter(char)
	  
		debounce = true
		
	end
end)
3 Likes

It works with a normal humanoid, so it might be a problem with your rig

What does your “ragdoller” module script do? Providing a place file would help; there’s no repro instructions and the example script is incomplete

I don’t use custom rigs, I use the r15 rigs from Roblox, and the problem is not the module, because with or without the ragdoll system, the changestate does not change the state to physics

Could you provide the module or a place file for reproduction purposes? I can’t reproduce the issue as the module script is missing

1 Like

Thanks for the report! I filed a ticket in our internal database and we’ll follow up when we have an update for you.

2 Likes

I’m having the exact same issue and I’m willing to provide a ragdoll module that I use. I have the exact same issue and the exact same weird hanging thing with the rigs occur, I use R6 btw.

local mod = {}
task.wait(0.3)

function mod:tempragdoll(Character : Model)
task.wait(0.1)
	local hum : Humanoid = Character:WaitForChild('Humanoid')
	hum:SetStateEnabled(Enum.HumanoidStateType.Running, false)
	hum:SetAttribute("Ragdoll", true)
	task.wait(0.05)
	task.spawn(function()
		local ragdollattribute = false
		if hum:GetAttribute('Ragdoll') == true then
			
			ragdollattribute = true
		end
		while ragdollattribute == true do
			task.wait(0.1)
			print(hum:GetState())
			hum:ChangeState(Enum.HumanoidStateType.Physics)
			
			if hum:GetAttribute('Ragdoll') == false then
				ragdollattribute = false
				break
			end	
		end
	end)
	hum:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
	

	
	hum.AutoRotate = false
	hum.BreakJointsOnDeath = false
	hum.RequiresNeck = false
	local hrp = Character:WaitForChild("HumanoidRootPart")
	
	

	hrp.RootJoint.Enabled = false
	for _, v in pairs(Character:GetDescendants()) do  --ragdoll
		if v:IsA("BasePart") then
			if v ~= Character.Torso then
				v.CanCollide = true
			end
			if v == Character.Torso then
				v.CanCollide = false
			end
		end
		if v:IsA("Motor6D") then	

			hum.BreakJointsOnDeath = false
			hum.RequiresNeck = false
			local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
			a0.CFrame = v.C0
			a1.CFrame = v.C1
			a0.Parent = v.Part0
			a1.Parent = v.Part1

			local b = Instance.new("BallSocketConstraint")

				b.LimitsEnabled = true
				b.TwistLimitsEnabled = true
				
				b.UpperAngle = 25
				b.Attachment0 = a0
				b.Attachment1 = a1
				b.Parent = v.Part0

				v.Enabled = false
			
		end
		
	end
end

function mod:dead(Character : Model)
	print("work")
	local hum : Humanoid = Character:WaitForChild('Humanoid')
	hum:SetAttribute("Ragdoll", false)
	
	hum.AutoRotate = false
	hum.BreakJointsOnDeath = false
	hum.RequiresNeck = false




	for _, v in pairs(Character:GetDescendants()) do  --ragdoll

		if v:IsA("Motor6D") then

			local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
			a0.CFrame = v.C0
			a1.CFrame = v.C1
			a0.Parent = v.Part0
			a1.Parent = v.Part1
			local b = Instance.new("BallSocketConstraint")

			b.LimitsEnabled = true
			b.TwistLimitsEnabled = true
			
			b.TwistUpperAngle = 50
			b.TwistLowerAngle = -50
			b.Attachment0 = a0
			b.Attachment1 = a1
			b.Parent = v.Part0

			v:Destroy()
		end
	end

end

function mod:recover(Character : Model)
	local hum = Character:WaitForChild("Humanoid") or Character:FindFirstChild("Humanoid") 
	for _,v in pairs(Character:GetDescendants()) do  --unragdoll
		if hum.Health == 0 then
			return
		end

		if v:IsA('Motor6D') then
			if hum.Health > 0 then
				v.Enabled = true
			end

		end
		if v.Name == 'BallSocketConstraint' then
			v:Destroy()
		end
		if v.Name == 'Attachment' then
			v:Destroy()
		end
	end


	hum:SetAttribute("Ragdoll", false)
	ragdolled = false
	hum.RequiresNeck = true
	hum.AutoRotate = true

end


return mod

I am a very rookie coder and having this issue was devastating to my confidence.
I’ve tried many MANY things to solve this issue and it has been months with no information on the topic.

this is my server side script for my respawning dummy, I saw some stuff about cloning being an issue but it seems very irrelevant.

local replicatedstorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local UIS = game:GetService("UserInputService")
local ragmod = require(game.ReplicatedStorage.myragdoll)
task.wait(0.1)


local dummy = workspace:WaitForChild("Dummy")


local dummyhum = dummy:WaitForChild('Humanoid')

dummyhum:SetStateEnabled(Enum.HumanoidStateType.Running, false)


dummyhum.BreakJointsOnDeath = true

local clonedumdum = dummy:Clone()
dummyhum.BreakJointsOnDeath = false

dummyhum.Died:Connect(function()
	ragmod:dead(dummy)

	task.wait(2.5)
	

	clonedumdum.Parent = workspace
	
	
	dummy:Destroy()
end)

I really hope this is enough information to find out what in the world is happening.

sorry for the code being so messy and a few useless variables here and there.

Hi,

If you’d like, you’re welcome to provide a place file so that we can try to reproduce it and help debug the issue.

On behalf of the physics team,
M0bsterLobster

1 Like

Don’t worry, I already realized what the problem was, well I don’t really know yet why it happened but now I know that the solution was to set networkowner(nil) to the characters

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.