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

My touched script doesnt work and i dont understand what the problem is. Any help?

Asked by
seikkatsu 110
4 years ago
Edited 4 years ago
script.Parent.Touched:Connect(function(hit)

    local humanoid = hit.Parent:FindFirstChild("Humanoid")

    if humanoid then

        print("touched by a humanoid")

    end

end)

This is a server script, parented to a part in the workspace and i dont understand why this isnt working. At first i thought it may be because of the condition in the if statement but i dont understand why it can be wrong

Any help is apriciated

0
i copy&pasted the script into my studio and it works fine Baselistic 103 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

What i guess is you have to say that humanoid is EQUAL to hit so if thats the case then


if humanoid == hit then print("A humanoid touched the part")
0
Im not sure about it though but hope it helps. Baselistic 103 — 4y
0
nope no output seikkatsu 110 — 4y
0
got it to work seikkatsu 110 — 4y
Ad

Answer this question