Hey scripters! My script that decreases player's health on touch of an npc doesn't work properly - it insta kills player with no debounce (i scripted it) Heres the script:
local RemoteEvent = game.ReplicatedStorage.RemoteEvents.ActivateJumpscareEvent
local debounce = false
script.Parent.Humanoid.Touched:Connect(function(hit)
if not debounce then
debounce = true
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
RemoteEvent:FireClient(Player)
Player.Character:WaitForChild("Humanoid").Health = Player.Character:WaitForChild("Humanoid").Health - 25
wait(1)
debounce = false
end
end)
The script is server script. Thanks!
