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.

local part = script.Parent

local function onPartTouched(otherPart)
    local partParent = otherPart.Parent
    local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
    if humanoid then
        print:("lol work coolio")
        --game.Lighting.Blur.Size = 843748673958
    end
end

part.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

local part = script.Parent

part.Touched:Connect(function(touched)
    print('Works')
    --add whatever here
end)

--If you want to locate the character that touched it
part.Touched:Connect(function(touched)
    local hum = touched.Parent:FindFirstChildOfClass('Humanoid')

    if hum then
        print('pog')
        --add whatever here
    end
end)

Answer this question