Clothing inserter not working

As the title goes, I am helping with this game make a clothing inserter for them but it doesn’t seem to want to work.

local code

gui.Selection.clothinginserter.holder.Shirt.Apply.MouseButton1Click:Connect(function()
	ShirtID = gui.Selection.clothinginserter.holder.Shirt.Text
	gui.Selection.clothinginserter.holder.ShirtRemote:FireServer(ShirtID)
end)

gui.Selection.clothinginserter.holder.Pants.Apply.MouseButton1Click:Connect(function()
	PantsID = gui.Selection.clothinginserter.holder.Shirt.Text
	gui.Selection.clothinginserter.holder.PantsRemote:FireServer(PantsID)
end)

server code

script.Parent.ShirtRemote.OnServerEvent:Connect(function(plr)
	if plr.Character:FindFirstChild("Shirt") then
		plr.Character.Shirt = script.Parent.Shirt.Text
	end
end)

script.Parent.PantsRemote.OnServerEvent:Connect(function(plr)
	if plr.Character:FindFirstChild("Pants") then
		plr.Character.Shirt = script.Parent.Pants.Text
	end
end)

Assuming that script.Parent.Pants is a textBox, using .Text, won’t work, because it will only change for the client, however you passed the id as a parameter, so I think just putting id as the parameter on the sever will work, like:

script.Parent.ShirtRemote.OnServerEvent:Connect(function(plr, shirtId)

And:

script.Parent.PantsRemote.OnServerEvent:Connect(function(plr, pantsId)
1 Like

put this on server code:

script.Parent.ShirtRemote.OnServerEvent:Connect(function(plr, id)
	if plr.Character:FindFirstChildWhichIsA("Shirt") then
		plr.Character.Shirt = 'rbxassetid://'..id
	end
end)

script.Parent.PantsRemote.OnServerEvent:Connect(function(plr, id)
	if plr.Character:FindFirstChildWhichIsA("Pants") then
		plr.Character.Pants = 'rbxassetid://'..id
	end
end)

Whats is the problem?
You dont set rbxassetid:// on the start of ID.
You dont get the id parameter in onserverevent.
You have used FindFirstChild, if the pants or the shirt have other name, your code brokes.

1 Like

I forgot to close this but I found a solution already. But thanks anyways!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.