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!
I asked for help on the ROBLOX Forums and they ended up with this. Script that didn't work:
local ContentProvider = game:GetService("ContentProvider") repeat wait() until game.Players.LocalPlayer.Character ~= nil repeat wait() until (ContentProvider.RequestQueueSize == 0) local Plr = game.Players.LocalPlayer local Char = game.Players.LocalPlayer.Character while true do wait(0.1) if script.Parent.Humanoid ~= nil then if script.Parent.Humanoid.Health ==1 then local ChangeFace = true local FaceId = {574701104, 574701264, 574701296, 574701328, 574701359, 574701387, 574701414, 574701431, 574701479, 574701532} wait(0.5) if ChangeFace then local var = FaceId[math.random(1,10)]'FaceId' Char:WaitForChild("Head").face.Texture = ("http://www.roblox.com/asset/?id=" .. var) end wait(0.1) script:remove() end end end
local ContentProvider = game:GetService("ContentProvider") repeat wait() until game.Players.LocalPlayer.Character ~= nil repeat wait() until (ContentProvider.RequestQueueSize == 0) local Plr = game.Players.LocalPlayer local Char = game.Players.LocalPlayer.Character while true do wait(0.1) if script.Parent.Humanoid ~= nil then if script.Parent.Humanoid.Health ==1 then local ChangeFace = true local FaceId = {574701104, 574701264, 574701296, 574701328, 574701359, 574701387, 574701414, 574701431, 574701479, 574701532} wait(0.5) if ChangeFace then local var = FaceId[math.random(1,#FaceId)] --#FaceId is the number of values in the table, so you don't have to continuously update the value Char:WaitForChild("Head").face.Texture = ("http://www.roblox.com/asset/?id=" .. var) end wait(0.1) script:remove() end end end
So what I did was remove 'FaceId' at the end of line 17, because it causes an error. Also instead of putting (1, 10) on line 17, you can put (1, #FaceId). #FaceId is the number of all the children inside of the table.
Hope this has helped!