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)