I want this script to change a variable in another script. The variable is called boxamount, in the script called Placegadget. this is what i have tried, but it won’t worke.
I don’t see where is the variable you’re trying to change, so I’ll stay generic :
To access a variable of an object, you an instance and the right to access it (=> public/protected/private, to keep it simple). Make sure your boxamount is public.
Also, I see your accessing the component Placegadget from the same object, to SendAMessage. You don’t need to do that to a function from it. It wored, but you didn’t take the shortest way (Get the component, get it’s transform, send a message to every components of that object, the first component pick it up, execute) when you just need to call SendMessage from the script you wrote.