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

Why does the Touched event not work?

	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.

1 comment

0

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.

1 answer

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

1 comment

0

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.