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)
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)