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

Random Face on Death?

Asked by 8 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!

I asked for help on the ROBLOX Forums and they ended up with this. Script that didn't work:

01local ContentProvider = game:GetService("ContentProvider")
02repeat wait() until game.Players.LocalPlayer.Character ~= nil
03repeat wait() until (ContentProvider.RequestQueueSize == 0)
04 
05local Plr = game.Players.LocalPlayer
06local Char = game.Players.LocalPlayer.Character
07while true do
08    wait(0.1)
09    if script.Parent.Humanoid ~= nil then
10        if script.Parent.Humanoid.Health ==1 then
11local ChangeFace = true
12local FaceId = {574701104, 574701264, 574701296, 574701328, 574701359, 574701387, 574701414, 574701431, 574701479, 574701532}
13 
14wait(0.5)
15 
View all 25 lines...
0
This is over complicating a very simple thing. User#5423 17 — 8y
0
Whoever decided to downvote me, boo you. You must not know a thing about how to use math.random(). As I was saying, line 17, remove 'FaceId' at the end. That's just a bug. Shawnyg 4330 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
01local ContentProvider = game:GetService("ContentProvider")
02repeat wait() until game.Players.LocalPlayer.Character ~= nil
03repeat wait() until (ContentProvider.RequestQueueSize == 0)
04 
05local Plr = game.Players.LocalPlayer
06local Char = game.Players.LocalPlayer.Character
07while true do
08    wait(0.1)
09    if script.Parent.Humanoid ~= nil then
10        if script.Parent.Humanoid.Health ==1 then
11local ChangeFace = true
12local FaceId = {574701104, 574701264, 574701296, 574701328, 574701359, 574701387, 574701414, 574701431, 574701479, 574701532}
13 
14wait(0.5)
15 
View all 25 lines...

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!

0
I tried it, it doesn't do anything :( Aurified 12 — 8y
0
Maybe because of line 10? It only runs if the player's health is 1 thehybrid576 294 — 8y
0
I changed it... It didn't work. Is there a specific place I have to put the script? Aurified 12 — 8y
0
is this a localscript or a serverscript? thehybrid576 294 — 8y
Ad

Answer this question