I have a uniform gui in my game with over 100 outfits in it. However, ever since the filtering enabled update, whenever you click on a uniform to wear, the uniform change only appears on your screen, and to others' POV all it does is remove your clothes.

I need help making a script that fixes this problem, so that the outfit that someone may select appears on everyone else's screen as well.

The coding for each clothing button goes like this: Pants:

local Player = game:GetService("Players").LocalPlayer
--Settings--
local Uniform = {}
Uniform.Pants = "AssetID"
--function--
function AddUniform(P)
	local Character = P.Character
	repeat wait(0) until Character ~= nil
	for i,Object in next,Character:GetChildren() do
		if Object:IsA("Pants") then
			Object:Destroy()
		end
	end
    local Pants = Instance.new("Pants",Character)
    Pants.PantsTemplate = Uniform.Pants
end
--GUIPart--
local Bin = script.Parent
if Bin:IsA("TextButton") or Bin:IsA("ImageButton") then
	Bin.MouseButton1Down:connect(function()
		AddUniform(Player)
	end)
end

Shirt:

local Player = game:GetService("Players").LocalPlayer
--Settings--
local Uniform = {}
Uniform.Shirt = "AssetID"
--function--
function AddUniform(P)
	local Character = P.Character
	repeat wait(0) until Character ~= nil
	for i,Object in next,Character:GetChildren() do
		if Object:IsA("Shirt") then
			Object:Destroy()
		end
	end
	local Shirt = Instance.new("Shirt",Character)
    Shirt.ShirtTemplate = Uniform.Shirt
end
--GUIPart--
local Bin = script.Parent
if Bin:IsA("TextButton") or Bin:IsA("ImageButton") then
	Bin.MouseButton1Down:connect(function()
		AddUniform(Player)
	end)
end

(Asset ID = Pants ID, or Shirt ID)

I don't understand how to fix this so I need the extra help!

2 comments

0

Learn about RemoteEvents and how to use them and then you'll easily be able to fix this yourself.