How do i make a accessory shop?

Hello, I am new to the Devforum and i would like to know how to make a GUI accessory shop thing. Is there any other way than making a folder in replicated storage and then sending a remote event to equip the accessory on your character?

Like this game : Uuhhh.wav - Roblox

1 Like

I will guide you through a simple way to make an accessory-equip system. The only thing you’ll want to have previous knowledge on are remote events and welding. To begin with, you’ll want to construct a simple UI button. You’ll want to add a local script under the button and add some code. This code will fire a remote event to the server telling the server to equip an accessory once the UI button is pressed (button.MouseButton1Down:Connect(function()).

Local Script

button.MouseButton1Down:Connect(function() --Detect when the button is pressed
     RemoteEvent:FireServer("Equip Accessory", accessory) --Fire an event to the server
end)

On the server-side, when it receives the event, you’ll want to equip the accessory to the player. To keep everything organized, I suggest creating a folder named “Accessories” in the ReplicatedStorage that holds all the accessories. If the accessory is a ‘traditional’ accessory, then there will be no need to weld it. If it’s a custom hat without any preset welds, then you’ll have to weld it manually through a script. Let’s say you just want to clone a regular accessory to the player. To achieve this, you’re code should look similar to this,
Sever Sided Script

local RemoteEvent = pathToRemoteEvent

RemoteEvent.OnServerEvent:Connect(function(player, topic, info) --Receive the event
     if topic == "Equip Accessory" then
          local newAccessory = info:Clone() --Clone the accessory
          newAccessory.Parent = player.Character --Place the accessory into the player's character
     end
end)
8 Likes

I’ve made an accessory shop before. If you’re going to be using items from the Avatar Shop you should then use the HumanoidDescription System as it very much simplifies applying shirts, pants, hats, hairs, body colors, or whatever you can normally put on your character.

Look above at @McRocketNuggets’ post for his explanation of remote events as the server must be doing the changing.

5 Likes

Thank you for this explanation.

1 Like