Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Shirt changer script?

I'm making a funny game called "Guest Simulator" and you are supposed to have different shirts. But the script won't work.

if char.Shirt == true then
	char.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=57282083"
else
	shirt = Instance.new("Shirt")
	shirt.Parent = char
	shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=57282083"
end

Output =

Shirt is not a valid member of Model

Script 'Players.Player1.Backpack.LocalScript', Line 19

2 answers

✓ Accepted answer

Try :

(Put this in LocalScript in starterpack)

Player = game.Players.LocalPlayer

wait(4)

Instance.new("Shirt", Player.Character)
wait()
Player.Character.Clothing.ShirtTemplate = "http://www.roblox.com/asset/?id=57282083"



It was saying "Shirt Not a valid Member of Model" because it turns out when the shirt is instanced(created) its not called shirt,Its called Clothing.

Hope it helped.

2 comments

0

Do it for everyone?

0

Yes.

Use :findFirstChild() to figure out if something exists.

if char:findFirstChild("Shirt") then
    char.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=57282083"
else
    shirt = Instance.new("Shirt")
    shirt.Parent = char
    shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=57282083"
end

2 comments

0

Doesn't work, nothing in the output

0

Can you edit your post and post the lines leading up to this part.

This discussion is preserved as it was. New answers, comments, and votes are closed.