NPC's continue sitting even though seat is destroyed

Hello! For some reason when an npc is sitting on a seat and it gets destroyed the npc keeps on sitting. Does anyone know why and how I can fix this??

3 Likes

Try this:

local NPC = script.Parent --location of your NPC
local Humanoid = NPC:FindFirstChildWhichIsA("Humanoid")

local function SeatChanged(seat: Seat?)
	if not seat then return end
	seat.Destroying:Once(function()
		if Humanoid.SeatPart == seat then Humanoid.Sit = false end
	end)
end

task.spawn(SeatChanged, Humanoid.SeatPart)
Humanoid:GetPropertyChangedSignal("SeatPart"):Connect(function()
	SeatChanged(Humanoid.SeatPart)
end)
3 Likes

Thank you so much that was indeed the problem now my npc wont keep sitting!

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