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

Random Shirt and Pants for NPC ?

Asked by 3 years ago

Hello everyone, for a few days I have been developing a game called "Zombie Panic: New Horizons", I want to make my zombies appear, with random shirts and pants.

However I can't make them appear with random clothes.

But yet I made this little line of code with just an ID of a shirt in the catalog and it works.

Code :

shirts = {
    1118202405
}

    local randomshirt = math.random(1,#shirts)
    local clothing = script.Parent.Clothing

    clothing.ShirtTemplate = 'rbxassetid://' ..shirts[randomshirt]

But when I try to make him have to choose a clothes at random, it doesn't work anymore, he puts my shirts on invisible, and sometimes makes me mistake.

Example of code with multiple shirts :

shirts = {
    1118202405, 
    1537761670, 
    1442388484, 
    4413177915, 
    1471488077, 
    751482380, 
    2403967461

}

    local randomshirt = math.random(1,#shirts)
    local clothing = script.Parent.Clothing

    clothing.ShirtTemplate = 'rbxassetid://' ..shirts[randomshirt]

This and my first forum post, I had already come here to see if any of my questions were already asked, but for once I can't find an answer to this error, so I just signed up and come and ask you for help.

Thanks for your help in advance.

ps : Yes I put "rbxassetid: //", but "http://www.roblox.com/asset/?id=" also makes the same error, also I can no longer make the error that displays me sometimes, but it was just an error loading the texture, and since he made me no mistake.

0
I did several tests again, but still the same problem. Maxime66410 14 — 3y

Answer this question