Okay so basically I am trying to fire an event to the server once the player’s health reaches zero and the script that responds to the event being fired to the server is supposed to do things bassed on a value within a folder found inside of the player but for some reason the script I used isn’t working at all and I didn’t get anything in output and I even added a print message to see if it was fired successfully but it did not work.
This is the code;
(the script is a server script within the character, i changed it from module and changed it up because it wasn’t working before either so i don’t know)
while true do
script.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
wait()
end
local Character = script.Parent
Character:FindFirstChild("Humanoid"):GetPropertyChangedSignal("Health"):Connect(function()
if Character.Humanoid.Health <= 0 then
game:GetService("ReplicatedStorage").Events.HandlerEvent:FireServer("PlayerDied")
print("The event has been successfully fired to the server!")
else
print("The event could not be fired to the server.")
end
end)