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

What's wrong with this sit script?

script.Parent.ChildAdded:connect(function(player)
if ClassName == "Weld" then 
 Player = game.Players:GetPlayerFromCharacter(Child.Part1.Parent)
    if Player then
	print("A player has sat!")
	
end	


end	





end)

3 comments

0

I have no idea what script.Parent is for, or where it is, so I have no idea.

0

For the seat

0

The Humanoid of the character has a bool value of Sit. Use that.

1 answer

✓ Accepted answer

You have not defined ClassName, so it will be always be nil. This means the condition on line 2 will always fail, since nil ~= "Weld".

The parameter to ChildAdded would be well called Child, like you use on line 3.

ClassName would then have the value of Child.ClassName.


script.Parent.ChildAdded:connect(function(Child)
	if Child.ClassName == "Weld" then 
		Player = game.Players:GetPlayerFromCharacter(Child.Part1.Parent)
		if Player then
			print("A player has sat!")
		end 
	end 
end)

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