Make objects stay visible after changing scenes, when it starts invisible

I know I ask a lot of questions but how do I make a invisible object stay visible when I make it visible and then go to another (like I make it so it goes visible after I do something but if I go to a scene and go back it goes invisible again)

7 Likes

you could use variables, so each time the scene changes the variable increases- then the object could have code saying

when (variable) = (number)
set invisiblity percent 0

if you don’t understand, tag me and ill screenshot some code. someone else moght come up with a better solution though!

btw, dont worry about asking questions! its all about learning and sharing knowledge.

5 Likes

Idk how to tag people

5 Likes

I tried it and it doesn’t work the object still goes invisible

5 Likes

Ok I figured out how to make it work without being invisible

6 Likes

Simply type the @ symbol, followed by the user’s username. You will see a list of names while typing it, so you’ll know how to spell them.

For example: @Crosbyman64 (my username)

6 Likes

Ok thanks for telling me

6 Likes

When a scene is switched, the when game starts rule runs again.

For single objects, just use a variable (which I would name runOnceS1, runOnceS2, etc.)

Then place the code you want to only run once instead a check if, checking if the variable is equal to 0, then do the code and set the variable to 1. Where you put the variable within the check does not matter, as long as it’s there. For best results, only place the set variable in the last object in the list (go into Bird Eye view by tapping the eye with lines to do this).

  • Even better, use an object variable instead, so that other objects won’t get negatively affected. You can just name it “runOnce”.

For objects with clones, all you need to do is check if total clones is equal to 1, then do the code (make sure it’s checked before it has a chance to clone the object, or else it will not work. You can usually do this by placing it above the rule that clones the object (if they execute on the same frame)). This method is also the best way to prevent any glitches related to excessive cloning (which causes lag) or objects looking like the original object when switching scenes repeatedly.

5 Likes

Ok can I use this for score so when an object is tapped the score goes up once

6 Likes

Definitely. You can also reset the variable used to make it run once to make the score increase again, when needed.

For this I would use a secondary variable, so something else doesn’t do something unexpected…

5 Likes

Ok them I can try to do the code

4 Likes