How do I make it that when a player touches a part there clothes texture id changes

How do I make it that when a player touches a part there clothes texture id changes

1 Like

you gotta use .Touched event for it

Put a script inside the part. Type this;

local clothId = 0000000 -- The id here
local part = script.Parent

part.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        local char = hit.Parent
        local shirt = char:FindFirstChildOfClass("Shirt")

        shirt.ShirtTemplate = clothId
    end
end)

Edit: Here are some stuff you might learn;

  1. Shirt
  2. Touched event
1 Like

i no but i wanna make it change the players clothes texture id

You can use what I sent. It’s just for helping you can change the variables and add more ids if you want.

but its not good to ask for scripts in devforum and you should make a script on ur own then ask help if it didnt work

Here are step by step instructions for a way to do this.

local OutfitPart = script.Parent
local OutfitChanger = OutfitPart.Parent 
local ShirtTemplate = OutfitChanger.Shirt.ShirtTemplate
local PantsTemplate = OutfitChanger.Pants.PantsTemplate

OutfitPart.Touched:Connect(function(TouchPart)
	if TouchPart and TouchPart.Parent and TouchPart.Parent:FindFirstChild("Humanoid") then
		print("Touched by player!")
		local Character = TouchPart.Parent
		Character.Shirt.ShirtTemplate = ShirtTemplate
		Character.Pants.PantsTemplate = PantsTemplate
	end


end)

-- Add the Build Rig plugin, open it up and add an R15 rig into the game.
-- Rename the Rig from dummy to OutfitChanger, right click in Explorer"Dummy" and rename it to OutfitChanger (u can name this what u want but the script has to match)
-- left click plus sign on Outfitchanger in your explorer window and add a shirt , rename it Shirt.  Do the same and add pants, rename it Pants.
-- Now find the ID for the shirt or pants you want.  Add them into the properties window for both the Shirt and the Pants. You can find the ids in the avatar shop.

-- Now insert a part, format it to the color and size that you want, and name it OutfitPart.  Move it into the Outfit Changer so it is all in once model.
-- Duplicate the outfit part and put the new part under the feet of the NPC rig.  It will be the stand.  Rename it NPCStand.
-- Add a Script into the OutfitPart and name it ChangeOutfit.  The script you type in is above.  It should now work.  U can do this for every outfit I want in my game.


rename Dummy
raname Shirt and Pants

Shirt ID
Insert part
![OutfitPart moved into the OutfitChanger model|205x401]
(upload://yt1loZ4XnCJNNyhWwdOdbwlbzb9.png)

Script inside OutfitPart named ChangeOutfit
Finished OutfitChanger