Why wont this small function work?

I have tried over and over again!

[blockcode]
if(w.object1.key == “key”) and (w.object2.myName == “box”) then

if (destroyNow = 1) then
w.object2:removeSelf();
else
changeIt()
end
end

end [import]uid: 59735 topic_id: 16797 reply_id: 316797[/import]

destroyNow = 1 should be:

destroyNow == 1

Also,
You have an extra “end” (which I assuming is a typo when posting).

[import]uid: 66859 topic_id: 16797 reply_id: 62875[/import]