This script is for a kicking animation, and I want it to deal damage whenever the players right leg (the one in the animation) hits another player.
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Mouse = Player:GetMouse()
local kicking = Instance.new("Animation", Humanoid)
kicking.AnimationId = "http://www.roblox.com/item.aspx?id=273619670"
local function keyDown(key)
key = key:lower()
if key == 't' then
local animTrack = Humanoid:LoadAnimation(kicking)
animTrack:Play()
end
end
Mouse.KeyDown:connect(keyDown)

6 comments
What would I do to check if it was a humanoid?
you could try: if toucher.Parent.Humanoid or toucher.Humanoid then humanoid.Health = humanoid.Health - damage
It keeps saying that It expects a" )" to close at line 24, but that still doesn't work
rLeg.Touched:connect(function(toucher) if toucher.Parent. Humanoid then local hitHuman = toucher.Parent.Humanoid hitHuman.Health = hitHuman.Health - damage elseif toucher.Humanoid then local hitHuman2 = toucher.Humanoid hitHuman2.Health = hitHuman2.Health - damage end end)
I tested it on a model and nothing happend ( I removed the end on line 33)
The model had a Humanoid in it