Not working Humanoid Health in Model used for vehicle damage model damage system

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Have Humanoid and script for use in part/model/vehicle to show it’s health…
    The ‘Died’ event fires when it wants to – is there a way to speed it up/force a check?
    Seems there is no way to get the script.parent.Humanoid.Health to use if needed …which would be much better than Died as can run a ‘repair/renew’ script and replenish the health when it gets low *or just clone a new

  2. What is the issue? Include screenshots / videos if possible!

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- This is an example Lua code block

local model = script.Parent
local humanoid = model.Humanoid
local HumHealth = script.Parent:WaitForChild(“HumHealth”)

humanoid.Died:Connect(function()
–[[
local explosion = Instance.new(‘Explosion’, workspace)
explosion.Position = script.Parent.Head.CFrame.Position --Your cords go here
explosion.BlastPressure = 500 --Set Blast Pressure here
explosion.BlastRadius = 500 --Set Blast raduis here
–explosion.ExplosionType = Enum.ExplosionType.CratersAndDebris – Set your explosion type here. 3 options ‘Craters and Debris’, ‘Desbris’, and 'No debris
explosion.DestroyJointRadiusPercent = 0
explosion.ExplosionType = Enum.ExplosionType.NoCraters
]]-- –
–This works but disabled to try other effects … set to allow you to script own damage
–set
HumHealth.Value = 111 – set an IntValue so can use something from this process to do what is needed in another script that watches it…

–script.Parent.Humanoid.Health = 50
script.Parent.wall.Transparency=1
script.Parent.wall.BrickColor = BrickColor.new(“Gold”)
–model:Destroy() – This works but disabled to try other effects

wait(4)
script.Parent.Humanoid.Health = 50 -- tried the waitforchilds/waitforclass doesn't work neither does  an 'if statement ' 

end)

– example of if statement
local maxvalue = 100
while true do – can’t use on healthchanged.connect either like in normal Humanoid
if script.Parent:waitforchild(“Humanoid”).Health >= 100 – or == 75 and do some regenration…or 50 or 25 … also use for specific destruction model access w/ transparent
–example
wait (4) script.Parent.Humanoid.Health = max_value – or 50 or 75 so you can slow repair…
but … none of that works as can’t access health value and again Died seems to take it’s time to fire …
any help/ideas I’ll give a shot will have a pic of the directory structure …
Have spent hours on this one and this is my first help post … am sure many will want this …if not for vehicle damage than building damage system
have tried syntax changes, and anything related to Humanoid in Dev the only topic on Died didn’t look like it would apply …but I tried it anyways … this is first of 2 in toolbox that actually even worked using Died … glitches ?

So essentially get some ‘normal’ form of function from the Humanoid to use to do something (in my case destroy or slow regenerate the part/model/vehicle that has been ‘shot’ ) — tried also going another way … but couldn’t find a script other than ‘ontouched’ for a part …which doesn’t work when shot … best found on that was something related to raycasting… maybe … touched worked great if my player walked into it… I’m good with a whatever works … just will be screwy if it’s Health = 0 and you have to wait for it to kick in… no nothing on a part being ‘shot’ so you can do math/checks on it and effect a healt/damage system

So you want to check for the humanoid’s health?

yes … for some reason the humanoid health inside model is being difficult in getting any output … with side bonus if someone figures how to get the Died event to not take excessive time…

New news, Have found that projectile weapons vs. ray weapons can be used for the ontouch on a part and may need to make an adjustment for all weapons to be projectiles in some way … side note the ray based weapons are ‘guns’ and they aren’t in real life to be used to kill a building/model while my tanks are all projectiles and made to do it… but I wasn’t asking I want full control over ‘anything’ that hits… meanwhile the Humanoid inside model even has the health bar and doesn’t care what you shoot it with so I’d really like to use it if I can get it to output anything useful … I’m actively trying off-the-wall solutions and seeing this may spawn a new subject into how to make a part act like ontouched when shot by raycast weapon … all under a damage system umbrella …

Humanoid:TakeDamage() can take a negative number but it’s not clamped so you can accidentally exceed MaxHealth.

Humanoids are intended for the core characters and as such they’re bloaty, insanely computationally expensive, do totally esoteric undocumented things like break the draw call batching, totally ruining your FPS, and just all around bad. So bad they’ve already provided us with an alternative for our custom controllers, and will probably be migrating the core characters over eventually. Character Controllers | Documentation - Roblox Creator Hub

You already have an instance value for health; why not just use that? Can check if health is below 0 in the value changed event to know when it died. If you need to pipe that died state externally then add a BindableEvent to the vehicle, name it Died, and fire it when ValueChanged <= 0.

I wish it could be so easy … it doesn’t seem to act normally when you try and get the health value from humanoid inside model …am checking the docs you posted… i’ve seen it go below 0 and thought of using the <= but can’t get any output to process… IDK if i’m just not formatting my query correctly … should just be a Humanoid.Health = = … no .Value it shows as it changes in workspace during play … may have a different option to try as ontouched works if I make all weapons projectile …but then would have to make a health bar for parts and scratch head to make weapons shoot a projectile …guessing that weapon script possibly decides how much damage it deals the interior humanoid ., so would have to make subsystem for that and get weapon name or something to guess how much damage … doable but more complicated as we go … Humanoid in model if able to actually access the data should hopefully be easier… again going to check the docs you posted … surprised so difficult when a vehicle health bar is so useful

Interesting subject… it doesn’t touch on hit or died events of the character …mostly movement … would been nice to have health add in in that … a cut down version of humanoid I can see being useful for the fps reasons you mentioned… bookmarked as I may need it for future project… the example I mentioned is findable in toolbox search: vehicle health … is first example …just to show you how wonky it works in a model …maybe you could find way to extract the output … hoping to detect if == 0 or less to do something…anything

So far I’ve basically given up on trying to use a humanoid in a model and had to do extensive experiments with a hit part to find something that could ‘record’ a hit … give it a unique name (the projectile) so that I could make a module script and Values that would allow for translation and upgrade … ie projectile1 = 20 lvl 2 projectile1=30, and so on (Values would be backed up via datastore and restored on game load … the hit part would use the damage reference and change various versions of model *looking more destroyed … with timer to repair it to 100%… having to design a bar that hangs over and changes to reflect damage taken as a changing decal on face of a welded part sucks… no easy way of doing this… if anyone has figured out how to use the humanoid in a model and gather or manipulate data from it please share or some other way to do … seems you need to recreate the wheel and design things with transparent hit ‘skeletons’ disable explosive damage and script everything … once you get started you will near the flexibility needed to wreck stuff in a ‘controlled’ way and at different levels per projectile damage … a fix/built in ‘something’ that would resemble this would be so useful imho for a destructible environment that more games are starting to have