How would in-game sellable clothing with Accessory

Hey devs :wave:t5: I have my own accessories for my game that is similar to gta5, how would I make in-game purchasable clothing that players would be able to buy? I searched almost everywhere for help but still couldn’t find what I was looking for. Thank you for reading this. :smiley:

if you want it so you can Buy an accessory with ingame money, you could check if they have enough money, subtract the amount of money and then use Humanoid:AddAccessory()

ill see what I can do so to my knowledge:

local Cash =
if Cash.Value >= Cost then
cash.Value -= Cost

but how will the Humanoid:AddAccessory work? if all my accessories are in replicated storage
cant I do ‘ReplicatedStorage. Folder. Har’?

P.S programming isn’t my profession

1 Like

yeah that’s basically it, just make sure that’s not a local script.


do you know how I can incorporate the script with a Humanoid:AddAccessory?

yeah its pretty simple firstly, you have to get the player that is buyings Humanoid, so in your case it would be:

Humanoid = player.Character:WaitForChild("Humanoid")

then after you get the Humanoid, just type in Humanoid:AddAccessory(ACCESSORY_INSTANCE)

1 Like

sorry if I’m overcomplicating things but I did something like this script:

local playerModel = script.Parent
local humanoid = playerModel:WaitForChild("Humanoid")

local Cash =
if Cash.Value >= Cost then
	cash.Value -= Cost

	humanoid:AddAccessory(HalfTiedDreads)	-- Attach the Accessory to the humanoid.


but it gives me an error, again sorry for making this post overcolpected

Oh. alright so you need to define half the things you are saying. In short your basically giving the computer a word and trying to tell it figure out what to do. For the Cost at the top write Cost = COST_AMOUNT

on line 6 you spelt Cash with a lowercase c when you defined it with a uppercase, and lastly the player is not defined, for the player it would be:

player = game.Players:GetPlayerFromCharacter(playerModel)

and lastly for the HalfTiedDreads, you would again have to define where the hair/hat is located in the game

now the only thing that is giving me an error is COST_AMOUNT

Edit: how will the script know which hair to attach to the player?

okay so Cost = (your cost amount (must be a number))

and secondly, if your hair is kept in serverStorage then:

HalfTiedDreads = game.ServerStorage.HalfTiedDreads

if its in ReplicatedStorage then

HalfTiedDreads = game.ReplicatedStorage.HalfTiedDreads

and so on

1 Like