Trying to make old 'Try on clothing Tool' Server Sided

So you know the try on tool that is created by Nikilis? Incase you dont know what the tool is for, it is something that people use in homestores/shops usually to try on clothing before buying;

The only problem about the script in the tool is that it is client sided and players in my homestore have been saying they cannot see what clothing their friends are trying on, and I want to make it server sided so others can see what clothing looks like on other players to make it a better experience, however I dont know the functions/events to use in order to edit the script to make specifically the part of the script where the clothes of the player changes to be server sided when the script is a local script, mainly just specific functions + methods are just what I’m looking for but any further information about that kind of stuff would be helpful as well.

I’ve tried numerous things such as making the first noobie thing to do since I dont script on the regular being making the entire local script a regular script instead, and the script cannot work if it is a normal script apparently so i changed it back to a local script.

Also recently I’ve tried something where I added a line in the script thats supposed to change a string value of the string value “shirt” or “pants” that is inside the humanoid that I added in to the string of the shirt/pants template that the player just tried on by adding one extra line on there; only thing is it acted like it was nil despite it being in the humanoid when anyone spawns and the value of that wouldn’t change, no bugs ever showed up in the output for this either, so make something work for a string value object is just not going to work.

the blue underlined is the values ive added to the humanoid, the red is me using the added value object to the script

Previously awhile ago before trying string values I tried to make it so if someones shirt changes the script would save the template id of the clothing and then remove + readd the shirt; but as you can tell since I wrote this… it didnt work

The only thing that I’ve gotten to work, BUT don’t want to use as a solution due to many fallbacks is instead of using the try on tool, making it so players have to click on a button besides the mannequin to try on clothing and make it visible to other players, I dont consider this to be ideal because for one my homestore has over 200 mannequin’s and I don’t want to be placing 200+ buttons around my store as a work around; and would be tedious for users to have to look for buttons to try on things

A few details about this incase I havent mentioned it yet is that the Try on tool is inside the starterpack since all the stuff is inside a tool/gear object, and the model (try on tool) that I’m trying to edit/improve by making clothes that got tried on to show server sided is SIX YEARS old, so a lot of the stuff in the script may also need to be optimized somehow
This is the link to the tool that I am trying to edit incase you want to look deeper into the script:


You could try overlaying the shirt and pants with a transparent part and added a server-sided script that detects mouse click.

Trick is to add a click detector, and in each individual part include the value of the shirt id inside of an IntValue that would fire to the server what to change the Player’s clothing ID to.

i would do that but in order for people to buy the clothing the user has to click on that without the tool, there is though the script that i have for all mannequins that adds a click detector for all limbs + torso available on the mannequin that allows users to buy a shirt/pants that uses the catalog ID of the shirt/pants, would that also work?

There’s no need to use a tool, it’s redundant. Click detector is a RemoteEvent that is fired when a Player left clicks their mouse when ClickDetector is a Child of the part they are clicking. I would put two separate ClickDetectors in 2 parts that cover both the shirt area and the pants area. Here’s the code:

for i,v in pairs(workspace:GetDescendants()) do
	if v:IsA("BasePart") then
		if v:FindFirstChild("ClickDetector") then
				--what would you like your code to do??

Few problems:

  • Iterating over every descendant in workspace can be tedious if you have LOTS of descendants.
  • You have some redundant code in your codeblock. The v:IsA("BasePart") is not needed because ClickDetectors inside of BaseParts are also descendants so you could reduce the code to just if v:IsA("ClickDetector") then ...
  • Some descendants might load after the script has executed.

I suggest putting all clothing models inside of a model/folder designated only for the clothing models and to iterate over that at the start of the game and then to await for more in case they happen to load in.

Example code:

local clothingContainer = ... --// reference the clothing container
local currentModels = clothingContainer:GetChildren()

local function wearClothing(player)
    --// simply "equip" the clothing now

local function modelAdded(model)
    local clickDetector = ... --// reference the click detector in a safe way
    --//  by safe I mean things like "WaitForChild"; etc.

    if clickDetector then

for i, model in pairs(currentModels) do

1 Like

You could change it on the client, fire a remote with information of the stand, then you could change it on the server by changing the template id of the players shirt which should make it visible to everyone else in the server.

Instead of using multiple buttons, you could use a single button and change it’s parent once the player is within range of a stand.