Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can i make a seat event that fires when someone seats on a block?

How can i make a event that fires when a player seats on a determined block?

1 answer

✓ Accepted answer

You can use GetPropertyChangedSignal:

local Seat = script.Parent

-- GetPropertyChangedSignal fires when the given property (in this case "Occupant") changes
Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
	local Occupant = Seat.Occupant
	-- Seats have a property called occupant. When a npc/player is seated, the occupant is set to their humanoid
	local Player = (
		Occupant
		and game.Players:GetPlayerFromCharacter(Occupant.Parent)
	)
	if Player then 
		print(Player)
	end
end)

1 comment

0

Thanks m8

This discussion is preserved as it was. New answers, comments, and votes are closed.