Finally got it to work!!
Note: I made the part the player walks through visible for presentation purposes
You can get it here:
How to use
Inside of the part, you will see a shirt and pants. Change the ShirtId and PantsId of shirts and pants to the id you would like to use.
Once you did that, it should work!
This entire thing is open-sourced, the code is here:
local door = script.Parent
local shirtId = script.Parent.Shirt
local pantsId = script.Parent.Pants
local shirt = nil
local pants = nil
local givenPlayers = {}
function touched(part)
if part.Parent:FindFirstChild("Humanoid") == nil then
return
end
if #givenPlayers ~= 0 then
for index = 1, #givenPlayers do
if givenPlayers[index] == part.Parent.Name then
return
end
end
end
shirt = part.Parent:FindFirstChildOfClass("Shirt")
if shirt ~= nil then
shirt:Destroy()
end
shirt = script.Parent.Shirt:Clone()
shirt.Parent = part.Parent
pants = part.Parent:FindFirstChildOfClass("Pants")
if pants ~= nil then
pants:Destroy()
end
pants = script.Parent.Pants:Clone()
pants.Parent = part.Parent
print("Gave uniform to " .. tostring(part.Parent.Name) .. "!")
givenPlayers[#givenPlayers + 1] = part.Parent.Name
end
door.Touched:Connect(touched)