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

How do you make a spawn that changes clothes?

How do you make a spawn that changes clothes on touch (for example, if a player touches a certain team's spawn the clothes will change to the team's uniform) Can someone please tell me what I am doing wrong. It makes the player naked. (Lol)

 local shirtid = "http://www.roblox.com/asset/?id=380839078"
local pantsid = "http://www.roblox.com/asset/?id=24642487"

script.Parent.Touched:connect(function(hit)
    if hit.Parent:findFirstChild("Humanoid")then
        char = hit.Parent
        if char:findFirstChild("Shirt") then
            char.Shirt.ShirtTemplate = 380839078
        else
            a = Instance.new("Shirt", char)
            a.Name = "Shirt"
            a.ShirtTemplate = 380839078
        end
        if char:findFirstChild("Pants") then
            char.Pants.PantsTemplate = 24642487
        else
            b = Instance.new("Pants", char)
            b.Name = "Pants"
            b.PantsTemplate = 24642487
        end
    end
end)


Thank you so much!

1 comment

0

try subtracting 1 from the ID until it works

1 answer

ShirtTemplate and PantsTemplate are both 'Content' values, NOT number values. In order to turn it into a content, change the id to "rbxassetid://id". Additionally, connect and findFirstChild are deprecated. Use Connect and FindFirstChild

3 comments

0

Instead of changing the template, remove the shirt and pants then using Instance.new insert a blank pants and shirts then change the template. Also using rbxassetid://id might also work.

0

What? You just said FindFirstChild is deprecated, so use FindFirstChild? Why do you want to use a deprecated item? Also, FindFirstChild is NOT deprecated.

0

@hiimgoodpack sorry, I accidentally put a capital F. Meant to put a lowercase f.

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