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
5 years ago
Edited 5 years ago
01script.Parent.Touched:Connect(function(hit)
02 
03    local humanoid = hit.Parent:FindFirstChild("Humanoid")
04 
05    if humanoid then
06 
07        print("touched by a humanoid")
08 
09    end
10 
11end)

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 — 5y

1 answer

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

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

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

Answer this question