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

How do I make the person sit?

Asked by 9 years ago

Alright so my script is supposed to make the player sit when it comes into contact with the left leg via animation but it doesn't work. My script so far:

01function onTouched (hit)
02    player.character.humanoid.sit = true
03 
04h = hit.Parent:findFirstChild("Humanoid")
05end
06 
07if h ~= nil then
08h.Sit = true
09 
10end
11 
12script.Parent.Touched:connect(onTouched)
13 
14function onTouched (hit)
15    script.Parent = character("Left Leg")
16    script.Parent:findFirstChild("Humanoid")
17    end
18    if script.Parent ~= nil then
19        h.Sit = true
20    end

1 answer

Log in to vote
0
Answered by
Scerzy 85
9 years ago

Most of your script isn't capitalized the correct way. You have to make sure you type everything exactly how it is, or it won't work. For example, in your second line, Player, Character, Humanoid, and Sit all have to be capitalized.

1script.Parent.Touched:connect(function(hit)
2local h = hit.Parent:findFirstChild("Humanoid")
3h.Sit=True
4end)

That is a very simplified version of the script you're trying to do, however, this doesn't incorporate the left leg part. A player will sit if any body part touches the parent brick. From what you said I think you want the player to sit when he comes into contact with a left leg? If that's the case, put this script as a child of that leg.

0
Thank you! It works now! funtimecameron886 0 — 9y
Ad

Answer this question