So i created a punch script, when you activate the tool it fires an animation and deals damage and flings the opponent away.
It does not seem to fling anyone away?
SCRIPT:
local Tool = script.Parent;
local Animation = script.Animation
local Replicated = game:GetService("ReplicatedStorage")
local Debounce = false
wait(2)
local Humanoid = game.Players.LocalPlayer.Character.Humanoid
local CanAttack = true
local attacking = false
local equipped = false
Tool.Equipped:Connect(function()
equipped = true
RightArm = Humanoid.Parent:FindFirstChild("LeftHand")
char = Tool.Parent
end)
Tool.Unequipped:Connect(function()
equipped = false
attacking = false
end)
Tool.Activated:Connect(function()
if CanAttack and not Debounce then
Debounce = true
CanAttack = false
attacking = true
local AnimationTrack = Humanoid:LoadAnimation(Animation)
AnimationTrack:Play()
RightArm.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum and hit.Parent ~= char and equipped and attacking then
local BodyVelocity = Instance.new("BodyVelocity", hit.Parent.HumanoidRootPart)
hum:TakeDamage(2)
hum.Sit = true
BodyVelocity.MaxForce = Vector3.new(5000, 5000, 5000)
BodyVelocity.Velocity = (char:FindFirstChild("HumanoidRootPart").CFrame.lookVector*100)
local Musics = game.Workspace.Music:GetChildren()
local RandomMap = Musics[math.random(1, #Musics)]
RandomMap:Play()
print(RandomMap)
end
end)
wait(1)
CanAttack = true
attacking = false
wait(3)
Debounce = false
end
end)
