local Players = game:GetService('Players') local toolName = 'FireGoodSword'
Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) local Humanoid = Character:WaitForChild('Humanoid') Humanoid.Died:Connect(function() if Character:FindFirstChild(toolName) or Player.Backpack:FindFirstChild(toolName) then
local Hum = Character:FindFirstChild("HumanoidRootPart") if Hum ~= nil then local fire = Instance.new("Fire") fire.Size = 50 fire.Parent = Character.HumanoidRootPart end-- here, after said player dies is where the effect would be end -- check tool name end) -- Died end) -- CharacterAdded
end) -- PlayerAdded
If you kill someone with a different sword but you have the FireSword in your backpack, it still happens. Why?
when you unequip your sword, it goes to the backpack. And since you searched the backpack AND the character (in line 6), it will give the fire effect even if you unequipped it.
Here's what you should do:
local Players = game:GetService("Players") local toolName = "FireGoodSword" Players.PlayerAdded:Connect(functinon(player) player.CharacterAdded:Connect(function(character) character:WaitForChild("Humanoid",10) -- change 10 to whatever you want the max wait time to be local Humanoid = character:FindFirstChild("Humanoid") Humanoid.Died:Connect(function() if character:FindFirstChild(toolName) then local hum = character:FindFirstChild("HumanoidRootPart") if hum ~= nil then local fire = Instance.new("Fire") fire.Size = 50 fire.Parent = hum end end end) end) end)