01 | local ContentProvider = game:GetService( "ContentProvider" ) |
02 | repeat wait() until game.Players.LocalPlayer.Character ~ = nil |
03 | repeat wait() until (ContentProvider.RequestQueueSize = = 0 ) |
04 |
05 | local Plr = game.Players.LocalPlayer |
06 | local Char = game.Players.LocalPlayer.Character |
07 | while true do |
08 | wait( 0.1 ) |
09 | if script.Parent.Humanoid ~ = nil then |
10 | if script.Parent.Humanoid.Health = = 1 then |
11 | local ChangeFace = true |
12 | local FaceId = { 574701104 , 574701264 , 574701296 , 574701328 , 574701359 , 574701387 , 574701414 , 574701431 , 574701479 , 574701532 } |
13 |
14 | wait( 0.5 ) |
15 |
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?
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 |
02 | local char = script.Parent |
03 |
04 | local FaceId = { 574701104 , 574701264 , 574701296 , 574701328 , 574701359 , 574701387 , 574701414 , 574701431 , 574701479 , 574701532 } |
05 |
06 | local id = FaceId [ math.random(#FaceId) ] |
07 |
08 | char:WaitForChild( "Humanoid" ).Died:wait() |
09 |
10 | char.Head.face.Texture = "http://www.roblox.com/asset/?id=" .. id |
11 | script:Destroy() |