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

Change Face on Death?

Asked by 7 years ago

I'm currently developing a group place but I have no idea on how to generate random faces (or decals). I have around 10 custom made faces I made specifically for that reason. I only know how to script a single face that appears on death... Can anyone help? Thanks!

1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
7 years ago

Using math.random, you'd randomly pick a value from the ids in a table. Here's an example:

local tab = {1,2,3,4,5}

print(tab[math.random(#tab)])

It'll print one of the random numbers in that table. You can change it up to change the face decal's id to one of your random ones.

Ad

Answer this question