So pretty much I have lots more code but it is this part that doesn't work
if humanoid.Health <= 0 then print("why") local function work(player) game.ReplicatedStorage.GiveFear:FireServer() print("noob") print(humanoid) print(humanoid.Health) end print("work") work() end
However, it does work when you do this
if humanoid.Health >= 0 then print("why") local function work(player) game.ReplicatedStorage.GiveFear:FireServer() print("noob") print(humanoid) print(humanoid.Health) end print("work") work() end
Can someone please explain why and how to fix this.
when the script is executed it checks if the player is dead before starting that local function so if the player is alive the local function will work, put the if statement in the function that should fix.