Clothing from GUI

I am trying to make it to where you click a GUI button it gives your player shirt and pants, but it doesn’t seem to be working. Any ideas?

Local Script:

local button = script.Parent
local player = game.Players.LocalPlayer
local remote = script.Parent.RemoteEvent

button.MouseButton1Click:Connect(function(player)
	remote:FireServer(player)
end)

Server Script:

remote = script.Parent.RemoteEvent
shirtID = 11148293891
pantsID = 10455440644

remote.OnServerEvent:Connect(function(player)
	local playerShirt = player.Character.Shirt
	local playerPants = player.Character.Parent
	playerShirt.ShirtTemplate = shirtID
	playerPants.PantTemplate = pantsID
end)
3 Likes

This might have to do with a permission problem. Did you publish the shirt, or do you own them? The same thing happens with animations.

Oh… I see. I don’t think you understand how the MouseButton1Click event works. It doesn’t pass a player argument. You might want to remove the declaration on line 5 in the local script, and you don’t need to pass your own player in the event, that’s automatically provided. You’re probably indexing nil on the server when you say .Character.

make local and add before id “rbxasset://id”

local shirtID = "rbxasset://11148293891"
local pantsID = "rbxasset://10455440644"
1 Like

It’s not:

"rbxassetid//..."

It’s:

"rbxassetid://..." (with a colon)
2 Likes

since it looks like a localscript is controlling the gui button, you don’t need to fire the clicker through the remote. the first parameter will always be the client that fired the event, even without passed variables. on the serverside, the input would look like this

(playerFrom, playerFrom)

Thank you , im fix it in moment

1 Like