Check what the name of seatpart i

I want to check what the seatpart name is, how would I do this?

humanoid.SeatPart == “DriveSeat”

humanoid.SeatPart.Name == “DriveSeat”

tried that it says index nil with name

That means the humanoid hasn’t sat down.

Can you share the complete code?

–Main Locals–

local player = game:GetService(“Players”).LocalPlayer

local humanoid = player.Character:WaitForChild(“Humanoid”)

–Main Script–

humanoid:GetPropertyChangedSignal(“Sit”):Connect(function(seat)

if humanoid.SeatPart.Name == “DriveSeat” and humanoid.Sit then

print(“Siting”)

else

print(“Not Siting”)

end

end)

Try:

if humanoid.SeatPart and humanoid.SeatPart.Name == “DriveSeat" then

print(“Siting”)

else

nope I also switched it arounfd

–Main Locals–
local player = game:GetService(“Players”).LocalPlayer
local humanoid = player.Character:WaitForChild(“Humanoid”)

–Main Script–
humanoid:GetPropertyChangedSignal(“Sit”):Connect(function(seat)
if humanoid.Sit == true then
if humanoid.SeatPart and humanoid.SeatPart.Name == “DriveSeat” then
print(“Siting”)
end
else
print(“Not Siting”)
end
end)

it isnt printing sitting

Try:

humanoid.Changed:Connect(function(att)
    if att == "SeatPart" and humanoid.SeatPart 
    and humanoid.SeatPart.Name == "DriveSeat" then
        print(“Siting”)
    end
end)

nope

humanoid:GetPropertyChangedSignal("Sit"):Connect(function(att)
	if humanoid.Sit == true then
		if att == "SeatPart" and humanoid.SeatPart and humanoid.SeatPart.Name == "DriveSeat" then
			print("Siting")
		end
	else
		print("Not Siting")
	end
end)
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

humanoid.Seated:Connect(function(isSeated, seatPart)
	if isSeated then
		if seatPart.Name == "DriveSeat" then
			--Do code.
		end
	end
end)

works! thanks for the amaizng help