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

Random shirt giver isnt working?

Asked by
sebanuevo 123
3 years ago

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

Log in to vote
0
Answered by
Dalamix 26
3 years ago
Edited 3 years ago

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

0
It gives me a error that says failed to load sebanuevo 123 — 3y
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. Dalamix 26 — 3y
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 sebanuevo 123 — 3y
Ad

Answer this question