whenever the player presses Q to punch it damages the player what do i do?
local user = game:GetService("UserInputService")
local play = game:GetService("Players")
local player = game.Players.LocalPlayer
local character = player.Character
local target = player:FindFirstChild("Humanoid")
local person = character:WaitForChild("Humanoid")
local anim = Instance.new("Animation")
local pain = true
anim.AnimationId = "rbxassetid://2642258675"
local key = Enum.KeyCode.Q
local function IsQkeydown()
return user:IsKeyDown(key)
end
local function Input(input, gameProcessedEvent)
if not IsQkeydown() then
else
print("hit")
local AnimationTrack = person:LoadAnimation (anim)
AnimationTrack:Play()
if target.Touched:Connect(function(hit)
target:TakeDamage(5)
end)
then end
end
end
user.InputBegan:Connect(Input)

2 comments
line 23: target.Touched is an event, it does not return a bool but returns a signal where you can connect function listeners
How do i do that?