seat.Touched:Connect(function(hit)
if hit.Parent.Humanoid then
print("it worked")
end
end)
it never prints "it worked." This script is NOT a localscript.
And the seat is anchored and part of a model.
seat.Touched:Connect(function(hit)
if hit.Parent.Humanoid then
print("it worked")
end
end)
it never prints "it worked." This script is NOT a localscript.
And the seat is anchored and part of a model.
I fixed it myself:
while wait() do
for i,v in pairs(game.Players:GetChildren()) do
if not v.Character then
print("waiting for character")
v.CharacterAdded:wait();
char = v.Character
else
char = v.Character
end
if char.Humanoid.Sit == true then
print(v.Name .. " is sitting")
end
end
end
what i did do was looping through all the players in a loop, in another loop. Then i made in the for loop a script that would check if the player is sitting
I have no idea why the Touched event doesn't work, though
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
This script works just fine. Check for syntax errors. Also for better debugging, use an "else" statement to check if it didn't find the humanoid in hit.Parent.