How can i make a event that fires when a player seats on a determined block?
✓ ANSWER ACCEPTED
How can i make a seat event that fires when someone seats on a 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)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thanks m8