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)
✓ ANSWER ACCEPTED
What's wrong with this sit script?
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.

3 comments
I have no idea what script.Parent is for, or where it is, so I have no idea.
For the seat
The Humanoid of the character has a bool value of Sit. Use that.