Hey Devfourm, MisterSpeaks here.
My script won’t work, I’m not sure why this is.
It’s set so once the player dies their face is changed to a different one, I also get no errors.
What happens is that the player’s face stays the same upon death and no changes occur.
Could anyone help me with this? (sorry for the newbie scripting skills)
try changing Face.Id to Face.Texture
Tried it out, still having this same issue of nothing changing
I would try using Humanoid | Roblox Creator Documentation
I’m not a expert in scripting either but I think when the script is running its going to skip by if Humanoid == 0
instead you want to use a function
instead of roblox.com use “rbxassetid://IDHERE”
and Humanoid.Died
As @ItIs_Super mentioned, you should definetely use Humanoid.Died
for what you’re doing!!
At the moment you’re using an if statement to determine if your character is dead or not which works but not for what you want it to work for. if statements only run ONCE in their called environment and so it wouldn’t really work for what you’re looking for because you ideally want to have your characters face changed EVERY time they die right?
Instead try using Humanoid.Died
which will work as a RBXScriptSignal in which you can connect your script to.
Heres an example!!
local Humanoid = script.Parent.Humanoid
Humanoid.Died:Connect(function() -- This fires when your Humanoid object "dies"
Face.Id = "YOUR_IMAGE_ID_HERE"
end);
Here’s the issue I run into: When the Humanoid dies, the Humanoid disappears. I try avoiding the Humanoid completely on all matters involving death
You’re probably doing it wrong and overcomplicating it.
In most cases, you would ideally want to listen for everytime a character spawns and THEN connect your Humanoid.Died
event which will fire everytime your given Humanoid dies.
Take a look at Player.CharacterAdded to see what I mean.
Hope this helps!
Thanks!
Here’s the final version of my script which is now working!
I had NO IDEA humanoid.died was a thing!
Good Job:) hope your game turns out well.
Awesome sauce!!
It’s always a good idea to come to the DevForum when you have a question like that to see what other developers may use as a solution.
Anyhow, happy scripting!
Cheers!!
Yeah, that’s why you gotta put the script in startercharacterscripts
I have Humanoid.Died events that I have left in code for months. All it will do, if it ever fires is print “OMG, it died!”
Clearly I’m doing it wrong. But, even when I capture death through health dropping to 0, or by killing the model directly, Humanoid is gone. I have to keep it alive to run a death animation and complete all residual commands, THEN let it die.
I see your usage case, in that case you might want to create a new topic to discuss this matter there and I’ll be able to help you if you’re still looking for a solution!!
I was offering workarounds. In this case, the problem doesn’t involve the Humanoid. If he is trying to catch Health = 0 a split second after death, there is no Humanoid and it breaks. Using the Died event works, so I’m glad it was resolved!