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

Player's shirt not changing?

Asked by 10 years ago

I am making something where It makes you wear a shirt automatically.

person = game.Players.LocalPlayer.Character
if person.Shirt ~= nil then -- Means if it isn't nil or not.
    person.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=133991511"
else
    shirt = Instance.new("Shirt")
    shirt.Name = "Shirt"
    shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=133991511"
end

It will not work. Help?

Thank you for the help.

0
Fixed the if statement. HexC3D 830 — 10y
0
Try again. HexC3D 830 — 10y

1 answer

Log in to vote
1
Answered by
HexC3D 830 Moderation Voter
10 years ago

The template of the shirt won't change online so you have to Clone the shirt into the player, I have done this myself and was also frustrated at the fact of it not working. So try this.

x = Instance.new("Shirt")
x.ShirtTemplate = "http://www.roblox.com/asset/?id=133991511" -- If you have not -1 from the end for the shirt I'D
game.Players.PlayerAdded:connect(function(plr)
z = plr.Character:GetChildren()
for i = 1,#z do
if z[i].Name = "Shirt" then
z[i]:Destroy()
x:Clone().Parent = plr.Character
end
end

If this helped +1, if this answered question check mark :)

0
The if statement is wrong. Grenaderade 525 — 10y
0
It's still wrong. Grenaderade 525 — 10y
0
? HexC3D 830 — 10y
Ad

Answer this question