So, I want to make it so when the player's health is below 25 it will enable a particle emitter.
This is in the Humanoid of a character called Model. The emitter is in the Torso.
local Humanoid = script.Parent if Humanoid.Health < 25 then script.Parent.Parent.Torso.ParticleEmmiter.Enabled = true else script.Parent.Parent.Torso.ParticleEmmiter.Enabled = false end
Your problem is that it's only checking the health once, right when the first player loads into the game. To fix this, you could connect it to any one of a few possible events, or just use a loop. So, let's go ahead and use the HealthChanged
event.
local Humanoid = script.Parent Humanoid.HealthChanged:connect(function(NewHealth) --Fires every time the health changes if NewHealth < 25 then --Checks the new health of the humanoid. script.Parent.Parent.Torso.ParticleEmmiter.Enabled = true else script.Parent.Parent.Torso.ParticleEmmiter.Enabled = false end end)
All this does, is fires a function every time the Humanoids health changes. So it should, in theory track every health change that's made to the Humanoid.
So now your code should work properly. If you have any further problems/questions, please leave a comment below, and I'll see what I can do. Hope I helped :P