Hey guys my name is Dev_Simphony and I made a script where you can kick. This script is working but the bodyVelocity that suppose to push the enemy in the direction of the opponent’s humanoid is not working. Could you please tell me why? btw I am using r6 idk if this changes anything but I just wanted to let you all know.
local remote = game.ReplicatedStorage.Kick
function sussify(player)
print(player)
local canDamage = Instance.new("BoolValue")
canDamage.Name = "canDamage"
canDamage.Parent = player
print(player)
canDamage.Value = false
end
-- firing all the player exist [first player]
table.foreach(game.Players:GetPlayers(), function(i, p) sussify(p) end)
game.Players.PlayerAdded:Connect(sussify)
remote.OnServerEvent:Connect(function(plr, player)
player.canDamage.Value = true
if player.canDamage.Value == true then
player.canDamage.Value = false
local event; event = player.Character["Right Leg"].Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
humanoid:TakeDamage(10)
local anination = Instance.new("Animation")
anination.AnimationId = "rbxassetid://6885472391"
local anim = humanoid:LoadAnimation(anination)
anim:Play()
local knockback = Instance.new("BodyVelocity")
knockback.MaxForce = Vector3.new(1,0,1) * 3000
knockback.Velocity = humanoid.Parent.HumanoidRootPart.CFrame.lookVector * 100
knockback.Parent = humanoid.Parent.HumanoidRootPart
wait(1)
knockback:Destroy()
player.canDamage.Value = false
event:Disconnect()
else
event:Disconnect()
end
end)
end
end)