How to detect if a player sitting is using R6 or R15?

  1. What do you want to achieve?
    I’m trying to play an animation when the player is sitting, and I’d like to make sure that it works on R6 and R15.

  2. What is the issue?
    I don’t know how to detect if the player is using R6 or R15 in a seat.

  3. What solutions have you tried so far?
    I tried to follow the method from this topic by detecting the seat.Occupant’s torso.

seat = script.Parent

local human
function added(child)
	human = seat.Occupant
	if human ~= nil then
		if seat.Occupant.Parent.Torso then
			anim = human:LoadAnimation(seat.SitAnimR6)
			anim:Play()	
		end
		if seat.Occupant.Parent.UpperTorso then
			anim = human:LoadAnimation(seat.SitAnimR15)
			anim:Play()	
		end
	end
end

function removed(child2)
	if anim ~= nil then
		anim:Stop()
		anim:Remove()
	end
end

seat.ChildAdded:connect(added)
seat.ChildRemoved:connect(removed)
2 Likes

The player’s humanoid has a property called RigType you can get the rigtype and see what type it is a R6 or R15

1 Like

Am I doing this right? Because the animation didn’t play at all.

seat = script.Parent

local human
function added(child)
	human = seat.Occupant
	if human ~= nil then
		if human.RigType == "R6" then
			anim = human:LoadAnimation(seat.SitAnimR6)
			anim:Play()	
		else
			anim = human:LoadAnimation(seat.SitAnimR15)
			anim:Play()	
		end
	end
end

no you werent
here i fixed it

seat = script.Parent

local human
function added(child)
	human = seat.Occupant.Humanoid
	if human ~= nil then
		if human.RigType == "R6" then
			anim = human:LoadAnimation(seat.SitAnimR6)
			anim:Play()	
		else
			anim = human:LoadAnimation(seat.SitAnimR15)
			anim:Play()	
		end
	end
end
1 Like

nvm, I fixed it.
I’ll just put the block of code here for the others who don’t know how to do so…

seat = script.Parent

local human
function added(child)
	human = seat.Occupant
	if human ~= nil then
		if seat.Occupant.RigType.Name == "R6" then
			anim = human:LoadAnimation(seat.SitAnimR6)
			anim:Play()	
		else
			anim = human:LoadAnimation(seat.SitAnimR15)
			anim:Play()	
		end
	end
end

function removed(child2)
	if anim ~= nil then
		anim:Stop()
		anim:Remove()
	end
end

seat.ChildAdded:connect(added)
seat.ChildRemoved:connect(removed)