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

How do you make a spawn that changes clothes?

Asked by 6 years ago

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!

0
try subtracting 1 from the ID until it works creeperhunter76 554 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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

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. YourMajesty_Kami 1 — 6y
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. hiimgoodpack 2009 — 6y
0
@hiimgoodpack sorry, I accidentally put a capital F. Meant to put a lowercase f. Thundermaker300 554 — 6y
Ad

Answer this question