Hey there.
I wanted to know if it was possible to detect when a humanoid sits in a seat.
So not just sitting down randomly, but rather sitting down in a seat.
Thanks.
Hey there.
I wanted to know if it was possible to detect when a humanoid sits in a seat.
So not just sitting down randomly, but rather sitting down in a seat.
Thanks.
https://developer.roblox.com/en-us/api-reference/property/Humanoid/SeatPart
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid:GetPropertyChangedSignal("SeatPart"):Connect(function()
if Humanoid.SeatPart ~= nil then
print(Player.Name.." is sitting in a seat!")
end
end)
end)
end)
local Humanoid = script.Parent -- Edit
Humanoid:GetPropertyChangedSignal("SeatPart"):Connect(function()
if Humanoid.Sit == true and Humanoid.SeatPart ~= nil then
print("Humanoid has started siting on " .. Humanoid.SeatPart)
else
print("Humanoid has stopped sitting.")
end
end)
As two people said already, using Humanoid.SeatPart.
Humanoid.Seated
event/signal would be better.
https://developer.roblox.com/en-us/api-reference/event/Humanoid/Seated