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

Random shirt giver isnt working?

Why this random shirt giver not working it should work but it just sets the player shirt to nothing

local Shirts = {"593659701"}
local Faces = {"14721869"}
local RandomShirt = Shirts[math.random(1,#Shirts)]
local RandomFace = Faces[math.random(1,#Faces)]

game.Players.PlayerAdded:Connect(function(p)
	p.CharacterAdded:Connect(function(c)
		local shirt = c:WaitForChild("Shirt")
		local face = c.Head:WaitForChild("Face")
		if shirt and face then
			shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=" .. RandomShirt
			face.Texture = "http://www.roblox.com/asset/?id=4369496449"
		end
	end)
end)

1 answer

✓ Accepted answer

That shirt template thing does not work like that, the whole id for the shirt has to be inside the quotation marks. Try making a table with different IDs(full asset URLs) like this:

local Shirts = {"http://www.roblox.com/asset/?id=323171733", "http://www.roblox.com/asset/?id=144076358"}
local Faces = {"14721869"}
local RandomShirt = Shirts[math.random(1,#Shirts)]
local RandomFace = Faces[math.random(1,#Faces)]

game.Players.PlayerAdded:Connect(function(p)
    p.CharacterAdded:Connect(function(c)
        local shirt = c:WaitForChild("Shirt")
        local face = c.Head:WaitForChild("Face")
        if shirt and face then
            shirt.ShirtTemplate = RandomShirt
            face.Texture = "http://www.roblox.com/asset/?id=4369496449"
        end
    end)
end)

I'd also suggest doing the same thing if you are making random faces too. Tell me if this works, because I'm not that much of an expert but it's worth a try.

EDIT: You can also change the IDs I put in the table, they're just for testing :D

3 comments

0

It gives me a error that says failed to load

0

When using your own ID or one of the ones in my suggestion? If it happens and it's talking about the shirt ID then that means that the shirt ID is unaccessible.

0

Oh nvm i solved it by adding shirts to a folder then select one and clone it then parent it to the character, it works great

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