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 8 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:

function onTouched (hit)
    player.character.humanoid.sit = true

h = hit.Parent:findFirstChild("Humanoid")
end

if h ~= nil then
h.Sit = true

end

script.Parent.Touched:connect(onTouched)

function onTouched (hit)
    script.Parent = character("Left Leg")
    script.Parent:findFirstChild("Humanoid")
    end
    if script.Parent ~= nil then
        h.Sit = true
    end

1 answer

Log in to vote
0
Answered by
Scerzy 85
8 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.

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

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 — 8y
Ad

Answer this question