How i am going to make this thing work? i'm trying to make knockback thing when players get hit by the punch script.
local dmg = true
local ready = true
local animations = {2491474896,2491473624}
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChildOfClass("Humanoid") and dmg == true and ready then
hit.Parent.LowerTorso.Velocity=hit.Parent.CFrame.lookVector *100 --the problem?
local hum = hit.Parent.Humanoid
local animation = Instance.new("Animation")
local picked = math.random(1,#animations)
animation.AnimationId = "http://roblox.com/asset/?id="..animations[picked]
local animTrack = hum:LoadAnimation(animation)
hum:TakeDamage(10)
script.Punch:Play()
animTrack:Play()
hum.WalkSpeed = 0
dmg = false
ready = false
wait(0.3)
dmg = true
hum.Walkspeed = 40
wait(0.7)
ready = true
end
end)
Thank you in advance
