Making NPCs Sit on seats properly without moving the seat when they get up

I have a game where you can build your own restaurant and guests can come and go and interact with their surroundings. However, I keep having loads of issues with getting them to sit down in chairs and on toilets.

When a guest stops sitting on a seat it will teleport via CFraming to an invisible part, GuestTargetPoint, in front of it which is the position the guests pathfind to. However, when they are CFramed, they also bring the seat with them and I don’t know why. The guests do not sit using Seat:Sit() because when I did this before, guests were unable to stop sitting even when using ChangeState, setting sit to false or jumping. They would be standing up but the humanoid still thinks they are sitting down and they cannot move anymore.

Here you can see the seat has moved:


The part on the left is the part they pathfind to (GuestTargetPoint), the part on the right behind the NPC is the actual seat. What happened was a guest got off the toilet on the left and sat on the one on the right, but it took the seat with it. This also breaks the game in other ways as the guests will pathfind to an occupied toilet and sit inside other guests because there are technically two seats in one position.

Correct positioning:
image

So I have decided I want to find out how to properly make my guests sit down without anchoring them and playing the sit animation.

My question is this: How can I get my NPCs to sit down on seats properly, without breaking themselves or taking the seat part with them?

Current code for sitting on toilets:

local toilet = SearchForItem(parentPlot, 'Toilet', humanoid.RootPart, true)
if toilet and not toilet.Occupied.Value and toilet:FindFirstChild('GuestTargetPoint') then
	local yield = PathfindNPC(body, humanoid, toilet.GuestTargetPoint.Position + Vector3.new(0, 0.5, 0))
	if yield and toilet and not toilet.Occupied.Value and 
	 (humanoid.RootPart.Position - toilet.GuestTargetPoint.Position).magnitude < 9 then
		toilet.Occupied.Value = true
		if toilet:IsA('Seat') then
			humanoid.RootPart.CFrame = toilet.CFrame + Vector3.new(0, humanoid.HipHeight, 0)
			humanoid.Sit = true
			body.Head.Anchored = true
			wait(math.random(8, 12))
			toilet.Occupied.Value = false
			body.Head.Anchored = false
			humanoid.Sit = false
			humanoid:MoveTo(toilet.GuestTargetPoint.Position)
		else
			wait(math.random(8, 12))
			toilet.Occupied.Value = false
		end
	else
		print('Too far! ' .. (humanoid.RootPart.Position - toilet.GuestTargetPoint.Position).magnitude)
	end
end

SearchForItem will return an object with the CollectionService tag ‘Toilet’, and PathFind is the function that makes the guests walk to the target. Occuiped is a Boolean that determines if there is a guest on the seat. There are two toilet classes in the game but the problem is with the seat type, seat:IsA(‘Seat’)

Thanks in advance!

Just anchor the seat or weld it to the toilet

It is. The seat is anchored and has no collision either. It shouldn’t be able to move at all. Nothing else is CFraming it, either

Im pretty sure you could just use the Seat object

I tried before, but it just breaks the humanoid. Once I stop the humanoid sitting down, it cannot move anymore. It says that sit = false but it won’t move anywhere, using MoveTo or setting WalkToPoint directly

But indeed there are no reasons for the seat to be moving unless you are welding it to the humanoid or it aint anchored/welded with the toilet

I know, that’s why I’m so confused and am trying to find other methods of making the guests sit down