如何检测玩家何时坐下
How to detect when a player sits
我想知道是否有一种简单的方法来检测玩家何时坐在特定的椅子上,而不是检测玩家是否触摸了座位,这并不总是有效。
有Humanoid.Seated信号。
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
-- listen for when the player sits down
character.Humanoid.Seated:Connect(function(active, seatPart)
-- active (bool) : true when a player is sitting
-- seatPart (Instance of Seat or VehicleSeat) : the seat that the player has just sat in or left
print(string.format("Is %s sitting? %s", player.Name, active and "yes" or "no")
print("the seat in question : ", seatPart)
end)
end)
end)
我想知道是否有一种简单的方法来检测玩家何时坐在特定的椅子上,而不是检测玩家是否触摸了座位,这并不总是有效。
有Humanoid.Seated信号。
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
-- listen for when the player sits down
character.Humanoid.Seated:Connect(function(active, seatPart)
-- active (bool) : true when a player is sitting
-- seatPart (Instance of Seat or VehicleSeat) : the seat that the player has just sat in or left
print(string.format("Is %s sitting? %s", player.Name, active and "yes" or "no")
print("the seat in question : ", seatPart)
end)
end)
end)