Code the buyHouseScript – For this project, we will start on Line 1 and end on Line 12. What we are trying to do is temporarily move the model to the ServerStorage before anyone can buy it. This way the player can only see the house once they’ve purchased it.
On Line 1, make a variable that defines the Cost of your House. After this we will place the House in the ServerStorage. This way it will be hidden from the player until they purchase the house in their game.
Connect the ClickDetector to the function.
Create an if thenstatement that checks if the player has enough Cash to purchase the House.
Line 6 subtracts the Cost of the House from the player’s Cash.Value. Line 7 moves the House back to the Workspace so the player can see it after purchasing.
Call a Destroy()function to delete the buyHouse sign after purchasing the House. Finally, there should be two instances of closing end statements.