My script runs once when it shouldent

Hello,
When i tried making a reviving system with my limited knowledge i got stuck on a problem.
The problem is that the thing works the script, but it only runs once when i think it shouldent.

It looks somewhat like this:

game.ReplicatedStorage.Downed.OnServerEvent:Connect(function(plr)

Here, everytime the player gets under 15 hp it fires the server using the remote event.
script works like i said, but as soon as the player dies the player cant get knocked somehow. This is the local script that checks for the hp:

local plr = game.Players.LocalPlayer

local RevPlr = plr.Character:FindFirstChild("Torso"):WaitForChild("RevivePlayer")
local humanoid = plr.Character:FindFirstChildWhichIsA("Humanoid")

local function pleHealthEnzo(humanoid, RevPlr)
	if humanoid.Health < 15 then
		RevPlr.Enabled = false
		print("Fire Server")
		game.ReplicatedStorage.Downed:FireServer()
	end
end



humanoid.Changed:Connect(function(property)
	if property == "Health" then
		pleHealthEnzo(humanoid, RevPlr)
	end
end)

im totally lost so i would love some explanation :slight_smile:

Note: I fixed it

where do you have the local script located?

Its fixed, had to add the var to false when the player died.

Starterchar btw

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.