Kicking Kick Ability

I have made a script, that kicks the player out when they are killed, by this kicking move, but it doesn’t work, or deal damage. There are no errors in output. Here is the script:

game.ReplicatedStorage.HamonKick.OnServerEvent:Connect(function(Player)
	local char = Player.Character or Player.CharacterAdded:Wait()
	local hum = char:FindFirstChild("Humanoid")
	local Kick = hum:LoadAnimation(script:WaitForChild("Kick"))
local HumRP = char.HumanoidRootPart
	Kick:Play()
	local HitBox = script:WaitForChild("HitBox"):Clone()
	HitBox.CFrame = char:FindFirstChild("Left Leg").CFrame
	HitBox.Parent = char:FindFirstChild("Left Leg")

	local Pweld = Instance.new("Weld")
	Pweld.Part0 = HitBox
	Pweld.Part1 = char:FindFirstChild("Left Leg")
	Pweld.C0 = HitBox.CFrame:inverse() * char:FindFirstChild("Left Leg").CFrame
	Pweld.Parent = Pweld.Part0

	HitBox.Touched:Connect(function(Hit)
	
		if Hit:IsA("Part") or Hit:IsA("MeshPart") then
			if Hit.Parent ~= char then
				local EHumRP = Hit.Parent:FindFirstChild("HumanoidRootPart")
				local Humanoid = Hit.Parent:FindFirstChild("Humanoid")

				if Humanoid then
					HitBox:Destroy()
					if Hit.Parent:FindFirstChild('Right Arm') then
						local enplr = game.Players:GetPlayerFromCharacter(Hit.Parent)



						Hit.Parent:FindFirstChild("Humanoid"):TakeDamage(50)
						local vel = Instance.new("BodyVelocity",EHumRP)
						vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
						vel.Velocity = HumRP.CFrame.lookVector * 70
						wait(1)
						vel:Destroy()
						if Humanoid.Health < 1 then

							enplr:Kick("Someone wasted their money apparently...")
							Player.leaderstats.moneys.Value = Player.leaderstats.moneys.Value + 50

						end
						end
				end
			end
		end	
	end)
end)








Add a print() and see if the event gets fired, if not there is a mistake somewhere else

1 Like

And…why not use Region3 to detect if opponent this in attack area?

1 Like

Actually in you case you only need to take damage 100
also remove this HitBox:Destroy()
also it only work for R6 only

1 Like

I know that it’s only for R6, I have made it that way, and @PedroGame007Pg , I’m not using region3, because, it’s only going to be a single hit, no AoE.

1 Like

The event does get fired, I did try debugging with prints.

1 Like
while true do
    wait()
    if game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Helth == 0 do
        game.Players.LocalPlayer:Kick("kicked!")
    end
end
1 Like

The code wouldn’t work if his code is server sided.

I’m not trying to kick the player using the kick ability, if I did somehow make that seem like it I’m sorry. The thing is, the person, who is using the kick attack, if they kill someone, with it, the person being killed, will be kicked.