End the game after all my diamonds taked..

Hi everybody, i need your help. i’m making a game with diamond. and i have 2 players. I want to end the game when every diamond is taked. but i dont know how to script it. Do i need to give a variable to my diamon or things like that ? i’m noob im progamming so plz i need your help as soon as posible :slight_smile: i wait your answer… i need the script plz :slight_smile:

you could define a variable, that’s the number of diamonds. You’ll have to check this number everytime a player makes a move. So, everytime a player makes a move, a function to check the number of diamonds will be called like so:

var diamondsNumber: int;
function CheckNumberOfDiamonds(){
if (diamondsNumber==0){
//show the "game over" panel