Humanoid trips and cant get back up when in water

I have a boss npc, that is suppose to walk around underwater, but it has major issues doing so.

Humanoid will end up randomly falling over under water, once in this state it CANNOT go back to normal
there is no statechange when this happens.
https://gyazo.com/2cc9832b5132d6e7bca0e496ceb80ab0 https://gyazo.com/4a52f8aa42c65bcee31695e4fe9b2c1d
https://gyazo.com/3b052860dba18935984d53a25d7c0671

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    i have tried to change the state to getting up every frame, turned off all the humanoidstates related to tripping and water.
script.Parent.HumanoidRootPart.Anchored = true


local Humanoid = script:WaitForChild("Humanoid")
Humanoid.Parent = script.Parent

Humanoid:SetStateEnabled(Enum.HumanoidStateType.Swimming, false)

Humanoid:SetStateEnabled(Enum.HumanoidStateType.Seated, false)
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Climbing, false)


Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
Humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)


local Animator = Humanoid:WaitForChild("Animator")
local Animation = script:WaitForChild("Animation")
local AnimationTrack = Animator:LoadAnimation(Animation)

local NotSpawnedAnimation = script:WaitForChild("Not spawned")
NotSpawnedAnimation  = Animator:LoadAnimation(NotSpawnedAnimation)


local SwipeAnimation = script:WaitForChild("Swipe")
SwipeAnimation = Animator:LoadAnimation(SwipeAnimation)


local Throw = script:WaitForChild("Throw")
Throw = Animator:LoadAnimation(Throw)


NotSpawnedAnimation:Play()
wait(5)

local function grow()
	for i, v in pairs (game.Players:GetPlayers()) do
		spawn(function()
		local ui = script.Halloween:Clone()
		ui.Parent = v.PlayerGui
		wait(5)
			ui:Destroy()
			end)
	end
	wait(1)
	script.Parent:FindFirstChild("HumanoidRootPart").Smoke.Smoke.Enabled = true
	warn("PumpKing has grown!")
	AnimationTrack:Play()
	script.Snaps:Play()
	wait(AnimationTrack.Length/2)
	NotSpawnedAnimation:Stop()
	script.Parent.Light.PointLight.Enabled = true
	script.Laugh:Play()
	script.Parent:FindFirstChild("HumanoidRootPart").Smoke.Smoke.Enabled = false
	wait(AnimationTrack.Length/2)
	script.Snaps:Stop()
	script.Parent.HumanoidRootPart.Anchored = false
end

grow()


function findNearestTorso(pos)
	local list = game.Workspace:children()
	local torso = nil
	local dist = 500
	local temp = nil
	local human = nil
	local temp2 = nil
	for x = 1, #list do
		temp2 = list[x]
		if (temp2.className == "Model") and (temp2 ~= script.Parent) then
			temp = temp2:findFirstChild("HumanoidRootPart")
			human = temp2:findFirstChild("Humanoid")
			if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
				if (temp.Position - pos).magnitude < dist then
					torso = temp
					dist = (temp.Position - pos).magnitude
				end
			end
		end
	end
	return torso, dist
end


local target = findNearestTorso(script.Parent.HumanoidRootPart.Position)
if target ~= nil then
	script.Parent.Humanoid:MoveTo(target.Position, target)
end


local lastPosition= script.Parent.HumanoidRootPart.Position


while wait(math.random(1,3)) do
	--Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
	local target, distance = findNearestTorso(script.Parent.HumanoidRootPart.Position, nil)
	if target ~= nil then
		script.Parent.Humanoid:MoveTo(target.Position, target)
		
		if (lastPosition -  script.Parent.HumanoidRootPart.Position).magnitude < 1 then

			script.Parent.HumanoidRootPart.stomping.Playing = false
			--Humanoid.Jump = true
		else
			script.Parent.HumanoidRootPart.stomping.Playing = true

		end
		lastPosition = script.Parent.HumanoidRootPart.Position
		
	end

end

1 Like

Judging by some of your clips, it looks like your Humanoid is entering a swimming state when he shouldn’t. According to another post I found it could be a matter of setting the state on the server as well. If that doesn’t work you might have to force it’s rotation to be upright or something like that.

1 Like

its only set on the server, this is not a local script.

1 Like