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

touch is not seeing any parts, what is the fix?

hi, i was testing FindFirstChild instance but its not working at all, i tried to make it say human touched me when a humanoid touch it, but its not working

script.Parent.Touched:connect(function(onTouched)
local Human = onTouched:FindFirstChild("Humanoid")
if Human then
print("human touched me")
end
end)

1 comment

0

I don't reallly what isn't working, but maybe it's the Part variable? Try naming the part "hit" instead of "onTouched". If that isn't it, maybe open the output, so we can see if any errors pop up

2 answers

✓ Accepted answer

I don't quite know what you're trying to achieve but if you're trying to make it Print when a Humanoid touches it then try this script:

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		print("human touched me")
	end
end)

Any problems then feel free to tell me!

1 comment

0

I will check it out when i can, when it worka i will accept the answer

You have to do onTouched.Parent:FindFirstChild("Humanoid") because onTouched will only give you the part that touched it, you want to get the parent of the part, which would presumably be a player, and then find the Humanoid within the player.

1 comment

0

wait a minute. I recognize you..... hmmm where could it be from? :)

This discussion is preserved as it was. New answers, comments, and votes are closed.