Ok, so here's my script. Its in a gui in starterGui:
local button = script.Parent
button.MouseButton1Click:connect(function()
local player = game.Players.LocalPlayer
local ShirtValue = 56082616
local PantsValue = 56079978
local shirt = player:FindFirstChild("Shirt")
local pants = player:FindFirstChild("Pants")
pants.PantsTemplate = "http://www.roblox.com/asset/?id="..PantsValue
shirt.ShirtTemplate = "http://www.roblox.com/asset/?id="..ShirtValue
end)
Every time I click on the button, I get the error message :attempt to index nil with 'PantsTemplate'. I've tried different ways of writing this line of code:
pants.PantsTemplate = "http://www.roblox.com/asset/?id=56079978"
and
pants.PantsTemplate = "56079978"
and
pants.PantsTemplate = 56079978
and
pants.PantsTemplate = "rbxassetid://56079978"
All of these versions return the same error. Any ideas why? Perhaps you cannot change PantsTemplate and ShirtTemplate like that?

1 comment
thanks. Although u would have to change Shirt.PantsTemplate to Pants.PantsTemplate or it wont work.