Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how would i make a sitting animation replace without a touched event? [closed]

Asked by 5 years ago
Edited 5 years ago

a lot of scripts that i've seen have a touched event on a seat that changes the animation, how could i make the animation work if someone sits down? I don't know how i would identify the player without a touched event either

tl;dr how could i identify a player sitting without a touched event?

Closed as Not Constructive by User#19524

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

You could use player added, and listen for a sit event.

game.Players.PlayerAdded:Connect(function(player)
local plrhum = player.Character:FindFirstChild("Humanoid")
plrhum.HumanoidStateType.Changed:Connect(function()
while plrhum.HumanoidStateType == Enum.Seated do
--Code Here
end
end)
end)

Humanoid state type 13 is the value for being seated. You can changed the while to be a if statement if you just want code to run once.

0
It has to be an enum, not the value or name User#19524 175 — 5y
Ad