Hey i’m trying to make it so when a player would die it woudln’t it would just stay at 1 hp so im doing that by making a damage script that starts everytime an event is being fired.
The problem is that the damage isn’t happending like the player ain’t taking any damage.
Here is my damage script:
game.ReplicatedStorage.DamageEvents.Damage.Event:Connect(function(Char, Damage)
print("Damage is happening")
local Health = Char.Humanoid.Health
print(Health)
print(Char)
if Damage < Health then
Health -= Damage
print("Damaged"..Damage.."HP")
else
Health = 1
end
end)
And here is the one that fires the damage script
if HitPart.Parent:FindFirstChild("Humanoid") ~= nil and Char.Name ~= Player.Character.Name and HitPart.Name ~= "Head" then
game.ReplicatedStorage.DamageEvents.Damage:Fire(Char, 40)
print("Hey")
elseif HitPart.Parent.Name ~= Player.Character.Name and HitPart.Parent:FindFirstChild("Humanoid") ~= nil or Char ~= nil and Char.Name ~= Player.Character.Name and HitPart.Parent:FindFirstChild("Humanoid") then
game.ReplicatedStorage.DamageEvents.Damage:Fire(Char, 70)
print("Sup")
end
The script is inside a raycast, dm me if you need more of the script.
It’s a tool btw(Revolver)