Hello, I've been having some issues with getting my uniform giver to work correctly with filtering enabled. It only works in roblox studio, so I assume it's a filtering enabled issue, but I need my filtering to be enabled.
It works by walking up to a locker, and a GUI prompts you for what clothes you want. This is the script I have inside of each button that does not seem to be working.
local shirtId = script.Parent.Shirt.ShirtTemplate --shirt template location
function onClicked(player)
print(player.Name.." clicked on Uniform Giver")
local foundShirt = player.Character:FindFirstChild("Shirt") -- Tries to find Shirt
if not foundShirt then -- if there is no shirt
print("No shirt found, creating for "..player.Name)
local newShirt = Instance.new("Shirt",player.Character) --creates new shirt
newShirt.Name = "Shirt" --new shirt name is shirt
else if foundShirt then -- if there is a shirt
print("Shirt found, reconstructing for "..player.Name)
player.Character.Shirt:remove() --removes shirt
local newShirt = Instance.new("Shirt",player.Character) --creates new shirt
newShirt.Name = "Shirt" --new shirtname is shirt
end
end
player.Character.Shirt.ShirtTemplate = shirtId --changes shirt Id to the template's Id
end
script.Parent.MouseButton1Down:connect(onClicked) --calls function onclick of gui

1 comment
"assetId" shouldn't have quotes, jsut a number string, which would end up as green numbers between the parenthesis