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

Why doesn't Touched fire when I connect it?

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

0
What type of script is it? Where's it parented? Are there any errors? Rare_tendo 3000 — 5y
0
For me it works. Where did you locate the part with the script? Also does it shows any errors? HeyItzDanniee 252 — 5y
0
Its parent is the block itself. No errors. @Doobb_yyus 0x5FE6EB50C7B537A9 0 — 5y
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... 0x5FE6EB50C7B537A9 0 — 5y
0
try doing a if statment, if a humanoid exists User#23365 30 — 5y

2 answers

Log in to vote
0
Answered by
Nabfam 20
5 years ago

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)
Ad
Log in to vote
0
Answered by 5 years ago
--it should be


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

Answer this question