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

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

Asked by 5 years ago
Edited by M39a9am3R 5 years ago

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.

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. GoldAngelInDisguise 297 — 5y
0
Are you using a localscript, or a normal script? It works fine with a normal script for me. NoahsRebels 99 — 5y
0
Please watch the language! Profanity is not permitted on our website. https://scriptinghelpers.org/help/community-guidelines M39a9am3R 3210 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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.

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 ???? HeadlessDeathSpeaker 9 — 5y
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. TheOnlySmarts 233 — 5y
0
Oh, sorry, i'm blind haha. fixmycode 86 — 5y
Ad

Answer this question