Health changed does not always detect

As i said in the title GetPropertyChangedSignal(“Value”) does not always detect health value, health sometimes going - values (no error on console) how do i fix that ?

2 Likes

Could you show us the parent of the script? So we could have a bit of reference.

2 Likes

Are you sure that is not detecting it? Assuming you are removing life from the client and that is a server script I don’t think it will detect that

2 Likes

3 Likes

script is works fine but sometimes just doesnt detect and yes script is serverscript

2 Likes

If you don’t detect it, are you sure it really took healt?

Could you try to put a print inside the block so you can make sure if when you take away the life the event is activated or not? I can also assume that maybe the Destroying variable is true.

Try to put also a print of “Destroying”

1 Like

From what I see, you never set back Destroying to false, thus the first statement would stop after the first time

2 Likes

image

destroying is still true after health is 0 but script worked fine

Then You find the problem read the condition that you put
image
Just put back the Destroying Var to false

i tried that but doesnt work but i figure out the problem , the problem is if the person attacking the part and closes the game while attacking health is going - values , how i can i fix that ?

1 Like

is the value going to negative?
I didn’t understand what you mean in the last part of the sentence

1 Like

yes, value is going to negative if player closes the game while attacking the brick and no one can click the brick after that

1 Like

Try inserting this in you’re script

function PutBacktoZero()
	-- // Put Back the Value to 0
	ConnectionPlayerLeave:Disconnect()
end

local ConnectionPlayerLeave = game.Players.PlayerRemoving:Connect(function()
	PutBacktoZero()	
end)

2 Likes

that works but changes other parts too

1 Like

What do you mean with this just change the specify value back to 0

1 Like

when 2 players attack different parts and one of the lefts the game the other part value is getting 0 too