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

I'm making a shirt/pants script but this isn't working?

Asked by 10 years ago

...it doesn't work. Normally what I would do is debug it, but today I got an unusual error that I have NEVER seen before. It involves WaitForChild, but that's all I know.

--Essentailly what this script does is clone a shirt and a pants from the ServerStorage, and puts it into the Player's character. At least it should.

cache = game.ServerStorage
cloth = cache.Clothes
game.Players.PlayerAdded:connect(function(ply)
    ply.CharacterAdded:connect(function()
        if ply.TeamColor.Name == "Mid gray" then
            shirt = ply.Character:WaitForChild("Shirt")
            pants = ply.Character:WaitForChild("Pants")
            shirt:Destroy()
            pants:Destroy()
            cloth.Inmates.prisontop:Clone().Parent = ply.Character
            cloth.Inmates.prisonbot:Clone().Parent = ply.Character
        end
    end)
end)

Here is the output.

18:05:41.752 - WaitForChild called on an Instance that is not in a DataModel.
18:05:41.753 - Script 'ServerScriptService.Script', Line 17
18:05:41.753 - Stack End
18:05:41.755 - Disconnected event because of exception

1 answer

Log in to vote
0
Answered by 10 years ago

im no genuis but this may work

shirt = ply.Character.Shirt
pants = ply.Character.Pants
Ad

Answer this question