For example i have a punch script that will punch when I press something on my keyboard.
local player = game.Players.LocalPlayer or game.Players.PlayerAdded.Wait()
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local uis = game:GetService("UserInputService")
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://" -- Your Animation id would go here
function onKeyPressed(inputObject, gameProcessEvent)
if inputObject.KeyCode == Enum.KeyCode.E then -- change E to the key you want
humanoid:LoadAnimation(anim):Play()
print("Animation is playing")
end
end
uis.InputBegan:Connect(onKeyPressed)
But when this hits a player I want it to damage them can somebody explain how i would do that?

2 comments
so if the player touches or "hits" another player, the player who would be hit takes damage?
Did you have a Value for the damage being dealt or is this being done script-based?