How would I get the userID of somebody sitting in a seat?

Title is self explanatory, I am trying to get the player ID of whoever sits in this seat. I’m not sure where to even look for this, so could anyone help? This is what I have so far.

local Seat = script.Parent

script.Parent:GetPropertyChangedSignal(“Occupant”):connect(function()
local Humanoid = Seat.Occupant
if Humanoid then
local Player = game.Players:GetPlayerFromCharacter(Humanoid)
else
end
end)

Any help is appreciated, thanks

You already have the reference Player pointing to the player’s instance, so you should be able to reference Player.UserId to get their ID.

2 Likes

not sure if you’re still accepting solutions but here you go

seat.Changed:Connect(function(property)
	local id = nil	
	local players = game.Players:GetPlayers()
	local playerName = seat.Occupant.Parent.Name
	for i=1,table.getn(players) do
		if players[i].Name == playerName then
			id = players[i].UserId
			break
		end
	end
	print(id)
end)