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

[SOLVED] I want a script that randomly picks a face, Any help ?

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 :

random = ("7074786, 7074764, 7699174 ,144075659")
script.parent.texture = ("random")

2 answers

local random = {
	7074786;
	7074764;
	7699174;
	144075659
}

local Picked = math.random(1,#random)

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.

random = {"7074786", "7074764", "7699174" ,"144075659"} — create an array with {} to store ids
script.Parent.Texture = "rbxassetid://"..random[math.random(#random)]

—first, attach rbxassetid:// with (..)
—access the array with []
—get something random with math.random() by putting it inside [], #random gets the number of items in the array

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