Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Need help with this glitch happening with kill effect?

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?

2 comments

0

Can you explain what the glitch is?

0

if you kill someone with a different sword, but you have that sword in your backpack, the fire kill still happens

1 answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.