Hello! The idea is when you kill somebody with linked sword the script checks humanoid's health and if its under 0 the kill effect occurs. I know how to make it with classic ROBLOX sword, but sword I'm using is scripted differently and I just cant understand it. Can somebody pls help me!!
Swords damage function:
local function IsAlive(Plr)
local Humanoid = Plr.Character:FindFirstChild("Humanoid")
return (Humanoid and Humanoid.Health > 0)
end
local function onTouched(Hit)
local Other = Hit.Parent:FindFirstChild("Humanoid")
if Other then
local Arm = Tool.Parent:FindFirstChild("Right Arm")
if Arm then
local Grip = Arm:FindFirstChild("RightGrip")
if (Grip and (Grip.Part0 == Arm or Grip.Part1 == Sword)) then
local O_Player = Players:GetPlayerFromCharacter(Hit.Parent)
if O_Player then
local S_Player = Players:GetPlayerFromCharacter(Tool.Parent)
if (IsAlive(S_Player)) then
if (S_Player) then
TagHumanoid(S_Player, Other)
end
end
else
Other:TakeDamage(damage)
end
end
end
end
end
Kill effect:
if character:FindFirstChild("Humanoid").Health <= 0 then
end

1 comment
I would recommend using modules, creating a separate system outside of the sword script, and playing them from the client.