0

# Making Sure Player has Clothes?

Edited 3 years ago
--------------------------------------------------------------------
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

0
Oh, and I did add template IDs to the (ID) parts LegoUnicornRoblox 37 — 3y

1
royaltoe 5144
3 years ago
Edited 3 years ago

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


0
I see that. Although, your check for if the shirt graphic needs to be before line 11 since that is where the script errors. I'll edit the answer to show how to fix that. royaltoe 5144 — 3y
1
Thank you so much LegoUnicornRoblox 37 — 3y