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

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

...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

im no genuis but this may work

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

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