Vehicle Selection

I am making a Mario Kart like game with a friend, and I wanted to make the vehicle selection. I have tried, but it just doesn’t work. Here is the game if you are interested:

Thanks!

Hi @TheLaidBackLama,

Do you have a question you want to ask? Have you provided enough information so that other people can replicate any problem themselves?

Geoff @ TechLeap

My question is, How do I do that? I have a bunch of different vehicles, and i used a “when this object is clicked” coblock with a “set variable vehicle to 1” and then i had that for all of them, just that the variable number would be one higher each time. Then i had under that a “if vehicle is not 0 then” coblock, and in that coblock i put “if vehicle = 1 then, else” with inside of the then section a “move object to startpoint” and “switch camera to”. I repeated this setup in the else section until i had all 8 vehicles. I thought this would’ve worked but it did not. When I click one vehicle it does nothing.

What exactly do you want/expect to happen when you click on a vehicle? It may help to give some background about your game/CoSpace.

Have you tried clicking on the Debug Code icon in the top right corner to watch which code is being triggered when you click on a vehicle? See the following video on how to do this:

It also might be better to include an image of your code, rather than describing the code - see the following video for how to do this:

Hope that helps! Let me know if you have any further questions about this.

Geoff @ TechLeap

What I want it to do is, when I click a vehicle i will spawn at the start line of the race track in that vehicle.
Thanks!

Ok, I see the problem - your 1st if-then statement is executed immediately, and what you want is for it to execute when you click on something.

So how could you achieve that?

Geoff

I found a way to do that, its not very efficient but it does work. The only downside is that you have to choose within a time limit. What I did was just put a “wait for 5 seconds” before the first if statement.
Thanks!

Have you used Functions before?

Also, are you aware you can click the wheel/cog icon in your if-then-else statement to add an else-if condition?

Geoff