Code :
1 | script.Parent.MouseButton 1 Click:connect( function () |
2 |
3 | local plr = game.Players.LocalPlayer |
4 | local Shirt = "http://www.roblox.com/asset/?id=128133687" |
5 | local Pants = "http://www.roblox.com/asset/?id=128133700" |
6 |
7 | plr.Shirt = "http://www.roblox.com/asset/?id=128133687" |
8 | plr.Pants = "http://www.roblox.com/asset/?id=128133700" |
9 | end ) |
To create an object you need to use Instance.new(object's class name, it's parent)
The shirt and pants are part of the character model and not the player instance. In addition, you need to change the ShirtTemplate
property of the shirt. This would like this:
01 | script.Parent.MouseButton 1 Click:connect( function () |
02 |
03 | local plr = game.Players.LocalPlayer |
04 | local char = plr.Character or plr.CharacterAdded:wait() |
05 |
06 | local Shirt = "http://www.roblox.com/asset/?id=128133687" |
07 | local Pants = "http://www.roblox.com/asset/?id=128133700" |
08 |
09 | if char:FindFirstChild( "Shirt" ) then |
10 | char.Shirt.ShirtTemplate = Shirt |
11 | else |
12 | local newShirt = Instance.new( "Shirt" ) |
13 | newShirt.Parent = char |
14 | newShirt.ShirtTemplate = Shirt |
15 | end |