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

Why doesn't Touched fire when I connect it?

script.Parent.Touched:connect(function(hit)
	print(hit)
end)

My actual code is irrelevant, since the event never fires, so even this doesn't work. Help??

EDIT: It seems to only not fire when the player touches it. hm

5 comments

0

What type of script is it? Where's it parented? Are there any errors?

0

For me it works. Where did you locate the part with the script? Also does it shows any errors?

0

Its parent is the block itself. No errors. @Doobb_yyus

0

I may have found the source of the problem, the old roblox loading script I'm using puts all parts in the camera for some strange, absurd reason. i don't really know how to fix that, sans rooting out the autorespawn script i wrote and deleting it...

0

try doing a if statment, if a humanoid exists

2 answers

Is the script parented to a block? If not, parent it to the block.

If that dosen't work, try this:

script.Parent.Touched:Connect(function (hit)
	if not hit then -- if hit dosen't exist then...
		print "oh noes!" -- uh oh! :(
		return nil -- exit program
	end
	 -- now this only runs if hit exists.
	print(hit.Name,',',hit.Parent.Name) -- should be something like "LimbName , PlayerName"
end)
--it should be


script.Parent.Touched:Connect(function(hit)
print(hit.Name)
end)

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