Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does the Touched event not work?

Asked by 5 years ago
    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.

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. MustangHeart 67 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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

0
I have no idea why the Touched event doesn't work, though BaconX112X 75 — 5y
Ad

Answer this question