How can I Add/Remove Health from a player when he clicks on a button GUI? I have made a script but it doesn't work for some reason
local humanoid = game.Players.LocalPlayer.Character.Humanoid
local currentHealth = humanoid.Health
game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(key)
if key == "N" and script.Parent.Visible == true and script.Parent.Enabled.Value == true then
script.Parent.Parent.Parent.Parent.Players.LocalPlayer.Character.Humanoid.Health = 1
end
the script if for a keybind it works the same as a button.

1 comment
keydown is deprecated, refrain from using it