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

script.parent.Touched script not functioning?

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!

2 comments

0

Please include your code. We can't help you if you don't even include your code.

0

RAFA1608 Lay off dude, stop being rude to people

2 answers

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)

2 comments

0

You can basically add anythign you want the script to do after if humanoid then line, such as mess with the lighting!

0

this does not work no idea why no output is so dumb

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)

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