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

script.parent.Touched script not functioning?

Asked by 3 years ago

I have seen numerous guides on this, and everyone says to use script.parent.touched , but for an unknown reason to me, in the dev console with the output, it does not show a print statement I put in the function. Please help!

0
Please include your code. We can't help you if you don't even include your code. RAFA1608 543 — 3y
0
RAFA1608 Lay off dude, stop being rude to people zane21225 243 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

Add this script to the part.

01local part = script.Parent
02 
03local function onPartTouched(otherPart)
04    local partParent = otherPart.Parent
05    local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
06    if humanoid then
07        print:("lol work coolio")
08        --game.Lighting.Blur.Size = 843748673958
09    end
10end
11 
12part.Touched:Connect(onPartTouched)
0
You can basically add anythign you want the script to do after if humanoid then line, such as mess with the lighting! Jakob_Cashy 79 — 3y
0
this does not work no idea why no output is so dumb danielminecrafter66 18 — 3y
Ad
Log in to vote
0
Answered by
zane21225 243 Moderation Voter
3 years ago
Edited 3 years ago

Honestly not sure why this is happening for you, but maybe you made some small error that's unnoticeable. Maybe try copy-pasting the code above this answer or the one I put below to see if that works

01local part = script.Parent
02 
03part.Touched:Connect(function(touched)
04    print('Works')
05    --add whatever here
06end)
07 
08--If you want to locate the character that touched it
09part.Touched:Connect(function(touched)
10    local hum = touched.Parent:FindFirstChildOfClass('Humanoid')
11 
12    if hum then
13        print('pog')
14        --add whatever here
15    end
16end)

Answer this question