Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make the person sit?

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

✓ Accepted answer

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.

1 comment

0

Thank you! It works now!

This discussion is preserved as it was. New answers, comments, and votes are closed.