I’m making a game where I want a knockout system so when a player knocks someone off the map they get 1 “KO” added to the leaderboard so i’m guessing you would have a number value in a leaderstat and add 1 to it when the player knocks someone off the map but how would I go about detecting this.
any help is appreciated.
Weapon Script
local clientCast = require(game.ServerStorage.ClientCast)
local db = false
local debounce = false
local slash
for i = -0.9,2.9,.1 do
local attachment = Instance.new("Attachment",script.Parent.Handle)
attachment.Name = "DmgPoint"
attachment.Position = Vector3.new(0,i,0)
end
local casterParams = RaycastParams.new()
casterParams.FilterDescendantsInstances = {script.Parent.Parent.Parent.Character or script.Parent.Parent.Parent.Parent.Character, script.Parent.Handle}
casterParams.FilterType = Enum.RaycastFilterType.Blacklist
local slashCaster = clientCast.new(script.Parent.Handle, casterParams)
slashCaster.HumanoidCollided:Connect(function(result, hithumanoid)
local Tool = script.Parent
local ToolP = Tool.Parent
local sound = Tool.Handle.Hit
local h = Tool.Parent:FindFirstChild("Humanoid")
local bv = Instance.new("BodyVelocity")
local offset = Vector3.new()
bv.MaxForce = Vector3.new(10000000,10000000,10000000)
bv.Velocity = h.Parent.Head.CFrame.LookVector * 55
bv.Parent = (hithumanoid.Parent.HumanoidRootPart)
wait(0.01)
bv:Destroy()
if hithumanoid.Parent:FindFirstChild("Effects") then
if not hithumanoid.Parent.Effects:FindFirstChild("Ragdoll") then
local z = Instance.new("BoolValue", hithumanoid.Parent.Effects)
z.Name = "Ragdoll"
local Debris = game:GetService("Debris")
Debris:AddItem(z, 2.5)
task.wait(0.1)
if not debounce then
debounce = true
sound:Play()
local Effect = game.ReplicatedStorage.HitBlock:Clone()
Effect.Parent = game.Workspace.HitEffects
Effect.CFrame = ToolP:GetPrimaryPartCFrame() * CFrame.new(0, -1, -4)
Effect.hitFx:Emit(5)
local Debris = game:GetService("Debris")
Debris:AddItem(Effect,0.5)
task.wait(0.2)
debounce = false
end
end
end
end)
script.Parent.Equipped:Connect(function()
local humanoid = script.Parent.Parent:FindFirstChild("Humanoid")
if not slash then slash = humanoid:LoadAnimation(script.Animation); slash.Priority = Enum.AnimationPriority.Action2 end
end)
script.Parent.Activated:Connect(function()
local Cooldown = script.Parent.Configuration.Cooldown
local ss = script.Parent.Handle.Swing
if not db then
db = true
slash:Play()
ss:Play()
slashCaster:Start()
wait(.5)
slashCaster:Stop()
wait(Cooldown.Value)
db = false
end
end)
script.Parent.Unequipped:Connect(function()
if slash then slash:Stop() end
slashCaster:Stop()
end)
Clip of how it would work
then player will get a 1 "KO"