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

Sit onTouched help?

Asked by
FiredDusk 1466 Moderation Voter
8 years ago

When I touch a part, i want the player to sit down. But if they jump, the stand (like normal)

script.Parent.Touched:connect(function(hit)

        local Player = hit.Parent:FindFirstChild("Humanoid")


        Player.Humanoid.Sit = true

end)

1 answer

Log in to vote
4
Answered by
funyun 958 Moderation Voter
8 years ago

Player already references the humanoid and not the character. Simply change line 6 to Player.Sit.

script.Parent.Touched:connect(function(hit)

        local Player = hit.Parent:FindFirstChild("Humanoid") --"Player" referring to Humanoid


        Player.Sit = true --Player.Sit == hit.Parent.Humanoid.Sit

end)
Ad

Answer this question