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

Random Face on Death Script?

Asked 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...

I don't know what is up with this script. I've tried everything I could... Is there something that needs to be changed? Thanks!

Also, which type of script should I put this in? Script? Local Script?

1 answer

Log in to vote
0
Answered by
cabbler 1942 Moderation Voter
8 years ago

This looks like an old, dangerous script. Since it uses LocalPlayer and ContentProvider then it would be a LocalScript. I would rewrite it to be serverside though, because I don't know if the face would replicate with filtering.

Here are some problems:

-Uses ContentProvider for seemingly no reason

-Uses LocalPlayer for no reason

-Only works in the rare case your health is 1

-Unnecessary loops and waits

-Uses remove()

Lastly the face texture idea is quite smart but you might look into PreLoading.

01--Script in StarterCharacterScripts
02local char = script.Parent
03 
04local FaceId = {574701104, 574701264, 574701296, 574701328, 574701359, 574701387, 574701414, 574701431, 574701479, 574701532}
05 
06local id= FaceId[math.random(#FaceId)]
07 
08char:WaitForChild("Humanoid").Died:wait()
09 
10char.Head.face.Texture = "http://www.roblox.com/asset/?id=" .. id
11script:Destroy()
Ad

Answer this question