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

Why won't my script run?

Asked by 9 years ago

I am making a storage that is able to move without the parts inside stopping it. When I try to use it, it does do anything. It is a regular script and it is inside of a part that is in the workspace. It gives no errors.

01local detector = script.Parent
02local toggle = true
03function Weld()
04    if toggle == true then
05        for i,v in pairs (detector:GetTouchingParts()) do
06            print("the part is" .. v.name) 
07        end
08    else
09 
10    end
11end
12wait(0.1)
13Weld()

1 answer

Log in to vote
0
Answered by 9 years ago

I don't think you can leave 'else' empty. But that might not be it. Also, you only need local if you're using a variable inside a function. So you can remove the "locals" in the beginning.

Ad

Answer this question