Hi there! I’ve recently been trying to debug this script, but it isn’t turning out for me. What im trying to achieve is a script where I have an ingame shop where I can purchase things with the money I have. I also want the gear that I bought, to go into my backpack when I buy it.
Here’s some pictures of the script"
Here is the error:
I have tried making the function at the top say plr and just deleting the player variable and I tried just having the player variable.
The script is Lua
If you could help me out on this it would be greatly appreciated!
The LocalPlayer should only be accessed from a local script, and not a server script (the normal one).
Also, you seem to be putting player as the parameter .MouseButton1Click returns as well, which is not correct, .MouseButton1Click doesn’t return any parameters
GUI stuff should be handled locally in a LocalScript, however, because of exploiters, you can’t trust the client to carry out transactions on its own. I recommend you store the player cash values on the server and have the LocalScript send a remote to the server to carry out the transaction.
In addition to exploit protection, client-side changes are not replicated to the server furthermore meaning that their new Cash cannot be seen by the server nor other clients.