-------------------------------------------------------------------- Character.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=(ID)" ----------------------------------------------------------------------------- Character.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=(ID)" if Character.Shirt == nil then Instance.new("Shirt").Parent = Character wait() Character.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=(ID)" end Character["Shirt Graphic"].Graphic = "http://www.roblox.com/asset/?id=(ID)" if Character["Shirt Graphic"] == nil then Instance.new("ShirtGraphic").Parent = Character wait() Character["Shirt Graphic"].Graphic = "http://www.roblox.com/asset/?id=(ID)" end
When I run this script, and the Shirt Graphic is equal to nil, it doesn't run the command told to if it is nil, in the console it just tells me "Attempt to index nil value"
I did add Template IDs into (ID) sections. Earlier in the script it told the script what Character is equal to
Line 11 tries to set the shirt graphic's graphics and will error if there is no shirt graphic since you can't set the graphics value of nothing.
Character.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=(ID)" Character.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=(ID)" if Character.Shirt == nil then Instance.new("Shirt").Parent = Character wait() Character.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=(ID)" end if Character["Shirt Graphic"] == nil then -- shirt doesn't exist Instance.new("ShirtGraphic").Parent = Character wait() Character["Shirt Graphic"].Graphic = "http://www.roblox.com/asset/?id=(ID)" else -- shirt exists Character["Shirt Graphic"].Graphic = "http://www.roblox.com/asset/?id=(ID)" i end