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

OnTouch doesn't work? Other scripts with OnTouch do work correctly!

So. I'm kinda getting angry because roblox doesn't work, again.

I have a couple of scripts that all get actived with OnTouch.

HOWEVER! ONE OF THE 8 DOESNT WORK? And all of them start and end the same.

Can you guys tell me why OnTouch doesn't register the part getting touched. WHILE ANOTHER SCRIPT IN THE SAME BRICK WITH ONTOUCH, GET'S REGISTERED....

local function onTouch()
	warn("HALLOOOOOOOOOOOOOOOOOOOOOOOOO")
	print("HALLOOOOOOOOOOOOOOOOOOOOOOOOO")
if (Gestart == 0) then 
	wait()
	Gestart = 1
	wait()
		warn("Voorshow Gestart Value = "  ..Gestart)
		if (Playing == 0) then 
			warn("Voorshow Playing Value = "  ..Playing.. ". The show has started")
			wait()
			Playing = 1
			wait()
		end
	end
end


script.Parent.Touched:Connect(onTouch)

It doesn't even print the warn() or print(). I also don't receive errorcodes in the log. WTF?

(The If Gestart and If Playing = is a Debounce. This method works in all of my other scripts.

3 comments

0

I tried it on a normal part and it did print and warn "HALLLOOO..." How different is this one part compared to the other parts? It might have to do with CollisionFidelity.

0

Are you using a localscript, or a normal script? It works fine with a normal script for me.

0

Please watch the language! Profanity is not permitted on our website. https://scriptinghelpers.org/help/community-guidelines

1 answer

In order for the function to run, you must call the function.

Using

part.Touched:Connect(onTouch) will simply call the function with the touched event.

Make sure to accept this answer.

3 comments

0

Sorry. That wasn’t the problem. It is in the script but I didn’t copy it to the script I showed here. So, the problem is still there. And it’s not the end or the beginning of the script ????

0

Procedurall, I'm pretty sure what you said is wrong. He did call the function at the end of the script. The script is inside his part so he did script.Parent.Touched instead of part.Touched. But good job on helping him anyways.

0

Oh, sorry, i'm blind haha.

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