Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Shirt changer script?

Asked by 10 years ago

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

Log in to vote
0
Answered by
iLegitus 130
10 years ago

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.

0
Do it for everyone? Grenaderade 525 — 10y
0
Yes. iLegitus 130 — 10y
Ad
Log in to vote
2
Answered by
Sublimus 992 Moderation Voter
10 years ago

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

0
Doesn't work, nothing in the output Grenaderade 525 — 10y
0
Can you edit your post and post the lines leading up to this part. Sublimus 992 — 10y

Answer this question