I have a rocket coming down from the sky. I want it to do something when it hits anything (including terrain). However, the following exert from my script script does nothing:
function onTouch(part) print("called") if ready then print("time for boom boom :D") end end script.Parent.Touched:connect(onTouch)
The script is not disabled or anything, it just doesn't recognize when the part touches something.
Also, IDK if this can affect it, but the part has a mesh in it.
I usually don't call functions. I call them directly so it won't be that confusing or something like that. Maybe this will fix your problem.
--local ready = true (Must be true) --If you want to do that if it's NOT ready then do "if not ready then"(Ready must be a variable set to false). script.Parent.Touched:connect(function(touch) print(touch.Parent.Name) --It will print the name of the thing that the rocket touched! if ready then --I'm assuming "ready" is an variable that's true. print("Time for boom boom :D") end end) --Don't forget the ")"
if I helped then --Click the "Accept Answer" down bellow else --Comment what's wrong and I'll try to fix it end