This script is supposed to give the npc I made a random face from a table of face id's. I know the problem but how can I get it to show the value of the random face instead of the index?
local faces = {22877700, 255827175, 8560971, 10907551, 209994929} local randomFace = math.random(1,#faces) script.Parent:WaitForChild("Head").face.Texture = "rbxassetid://"..randomFace
Just change line 3 to:
local faces = {22877700, 255827175, 8560971, 10907551, 209994929} local randomFace = faces[math.random(1,#faces)] script.Parent:WaitForChild("Head").face.Texture = "rbxassetid://"..randomFace
In your script, you are saying that randomFace = a random number from 1 - 5, which is not what you want. But in the revised script, it is getting a random 1 - 5 from the table faces (ex. faces[1], faces[2], etc etc.) You can also do;
local faces = {22877700, 255827175, 8560971, 10907551, 209994929} local randomFace = math.random(1,#faces) script.Parent:WaitForChild("Head").face.Texture = "rbxassetid://"..faces[randomFace]
Hope this helps