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)
sure. [UPDATED]
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 function checkHit() local rLeg = Character:WaitForChild("Right Leg") local damage = 15 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) end) end Mouse.KeyDown:connect(keyDown, checkHit)
Glitch you're right but the Player.Character or Player.CharacterAdded:wait() the "player" is a nil value so it would have to be changed or it would bug and you would have to fix the script but gg GlitchMaster.