Here is the script its not the best but it my try at it im kinda in experienced
This is my full script i tried my best
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?id=873178948"
Player = game.Players.LocalPlayer
mouse = Player:GetMouse()
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Animation = Instance.new("Animation")
function Hit(damage)
if damage.Parent:FindFirstChild("Humanoid") and damage.Parent.Name ~=
Player.Name then
damage.Parent.Humanoid.Health = damage.Parent.Humanoid.Health -1
end
end
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local animTrack = nil
local CanDamage = true
local CanDamage = false
CanDamage = false
Mouse.KeyDown:connect(function(key)
if key:lower() == "q" then
local character = Player.Character
animTrack = character:WaitForChild("Humanoid"):LoadAnimation(animation)
animTrack:Play()
Player.Character["Left Arm"].Touched:connect(Hit)
local CanDamage = false
end
end)

12 comments
messy thread , please organise it properly.
k
Why do you define "CanDamage" twice?
This should help with formatting your code, https://forum.scriptinghelpers.org/topic/82/how-to-format-questions-answers-on-the-main-site
thank you
I didn't know the site had that :o Thank you for the information ^^
lol
@CaptainJ222 the problem is the way you are using / creating the CanDamage variable.
please explain
Where are you connecting the "Hit" function?
oh umm
dosnt function Hit(damage)