Sorry if i'm asking for a script, i'm not used to scripting.
So here is what i want to do. I want a script that randomly picks a face (e.g picks 7074786, 7074764, 7699174 or 144075659.) for a fake person. But i don't know how to make that happen Here is what is think it would be like :
1 | random = ( "7074786, 7074764, 7699174 ,144075659" ) |
2 | script.parent.texture = ( "random" ) |
01 | local random = { |
02 | 7074786 ; |
03 | 7074764 ; |
04 | 7699174 ; |
05 | 144075659 |
06 | } |
07 |
08 | local Picked = math.random( 1 ,#random) |
09 |
10 | script.Parent.Texture = "http://www.roblox.com/asset/?id=" ..random [ Picked ] |
(Your guess is pretty good so it’s not asking for a script, don’t worry)
That code is almost complete, but to pick something random, we use the function math.random
.
We also need to add rbxassetid://
to the front of the string as that’s what a decal's Texture
property takes.
1 | random = { "7074786" , "7074764" , "7699174" , "144075659" } — create an array with { } to store ids |
2 | script.Parent.Texture = "rbxassetid://" ..random [ math.random(#random) ] |
3 |
4 | —first, attach rbxassetid:// with (..) |
5 | —access the array with [ ] |
6 | —get something random with math.random() by putting it inside [ ] , #random gets the number of items in the array |