Hello ! I’m trying to make hat inventory and my problem is how can I make every seconds that if I buy the hat it gonna add the hat in my accessory inventory. I only can make the tool inventory. so this is my first I created hat/Accessory inventory and I need help. I literally have no Idea how to make it.
Once the player confirms the purchase in the shop, send a remote event, to check if the player has enough cash and as an argument send the hat’s name that the player wants to buy.
After that the server script should have a table that will hold all every player’s hats.
If the player has enough cash to purchase the item, check if the player already owns that item to make sure you won’t duplicate it.
If the player doesn’t own it, then add the hat’s name to the table, like so:
Let me explain.
When you fire a remote event from a client, and when a server receives it, the first argument will be a player instance who called the remote event
you can name it whatever you want it to be.
However, I forgot to say in my initial post, that you should modify this piece of code, since I forgot that the first argument isn’t a string, and that I forgot to replace [player name] to [playerName.Name]
by the way It have orange underline did I have to change it or ignore it on script that you correct me? and one more orange underline is in this code myRemote:FireClient(playerName, playerHats[playerName]) It have orange underline at (playerName, playerHats[playerName] and why is it FireClient ? didnt it have to be FireServer ? because on the script you type .OnServerEvent ? when I read the developer hub FireClient is for .OnClientEvent Please correct me if I’m wrong
I read on this two links or maybe I misunderstood. Because Im new ?