How to detect if player is wearing certain clothing?

Hi all,

Before we start, yes I have acknowledged this is a duplicate, however, I can’t figure out how to use that answer in my own case. I have a disguise booth that changes both your pants and shirt when touching. I only need to detect one of them (pants & shirt) because they are changed together. How can I check to see if a player is wearing an item of specific clothing (they used the disguise booth?)

1 Like

I’m assuming it’s using the classic pants/shirt.
You could try having the script listen to when “ShirtTemplate” or “PantsTemplate” value of the shirts/pants in the character changes, and doing an if-statement to check if the ID is the one you want to detect.

3 Likes

I’ve done that from a touched event (which you can find the players character by using) however, I can’t figure out how to get the character in other cases (excluding playerAdded)

Can you explain in more detail about how the script is going to work?
Is this a local, or server side script? Because if its local, you can easily just do

local char = game.Players.LocalPlayer.Character

or something like that.

actually it’s kind of simple, We will make a table for Un-need items (arms, legs, etc) and for Needed items then we will use PlayerAdded event

local UnNeededItems = {"Right Arm" , "Left Arm" , "Right Leg" , "Left Arm" , "HumanoidRootPart" , "Torso" , "Head"} --//  Change It According to the game (R6 or R15) \\--
local NeededItems = {}
game.Players.PlayerAdded:Connect(function(Player)

end)

then we will use CharacterAdded Event and add a wait(10) do the character fully loads

local UnNeededItems = {"Right Arm" , "Left Arm" , "Right Leg" , "Left Arm" , "HumanoidRootPart" , "Torso" , "Head"} --//  Change It According to the game (R6 or R15) \\--
local NeededItems = {}
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
wait(10)
end)
end)

now we will use a for loop to see everything inside the Character

local UnNeededItems = {"Right Arm" , "Left Arm" , "Right Leg" , "Left Arm" , "HumanoidRootPart" , "Torso" , "Head"} --//  Change It According to the game (R6 or R15) \\--
local NeededItems = {}
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
wait(10)
for _ , v in pairs(Character:GetChildren()) do

end
end)
end)

now we will use table.find

local UnNeededItems = {"Right Arm" , "Left Arm" , "Right Leg" , "Left Arm" , "HumanoidRootPart" , "Torso" , "Head"} --//  Change It According to the game (R6 or R15) \\--
local NeededItems = {}
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
wait(10)
for _ , v in pairs(Character:GetChildren()) do
if not table.find(UnNeededItems , v.Name) then
table.insert(NeededItems , v.Name)
end
end
end)
end)

now you can do whatever you want with them

local UnNeededItems = {"Right Arm" , "Left Arm" , "Right Leg" , "Left Arm" , "HumanoidRootPart" , "Torso" , "Head"} --//  Change It According to the game (R6 or R15) \\--
local NeededItems = {}
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
wait(10)
for _ , v in pairs(Character:GetChildren()) do
if not table.find(UnNeededItems , v.Name) then
table.insert(NeededItems , v.Name)
end
end
end)
end)

for i = 1 , #NeededItems do
print(tostring(NeededItems[i])
end