- Home /
Player Money not working
i am a okay scripter and these are basic scripts bound to change so here is the itemdatabase script :
@script RequireComponent(PlayerMoney);
string var ItemPrice = 0;
if(ItemPrice < PlayerMoney)
print("You Do Not Have The Money For that Item");
if(ItemPrice > PlayerMoney)
print("You have successfully bought this item");
function OnMouseDown(){
}
and here is the player money script he starts off with no money but here it is :
@script RequireComponent(ItemDataBase);
string var PlayerMoney = 0;
if(ItemPrice < PlayerMoney)
print("You Do Not Have The Money For that Item");
if(ItemPrice > PlayerMoney)
print("You have successfully bought this item");
and i keep getting this error:
Assets/Scripts/PlayerScripts/PlayerMoney.js(2,7): UCE0001: ';' expected. Insert a semicolon at the end.
its asking me to put a semicolon beside string but when i do so it gives me a bunch of errors thank you to anyone who helps
Answer by Loius · Nov 04, 2012 at 07:01 PM
1) Capital letters in English are for the start of sentences, and for proper nouns (the names of things, like Loius).
2) You need to work through Unity tutorials. "string var ItemPrice" is nonsensical and you have executable statements outside any executable block (where's Update?).
3) There's no ; after an @script directive (that's a tricky one, I still do that all the time).
thank you and i actually have worked through the unity tutorials and the tornado twins tutorials
Your answer
Follow this Question
Related Questions
Need a "ghost" script ! 1 Answer
Raycast Destroys player. 1 Answer
Buying an Item from the Shop for One Player 1 Answer
health bar script please help 2 Answers
Action activates trigger. 1 Answer