Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Need help with this glitch happening with kill effect?

Asked by 3 years ago

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?

0
Can you explain what the glitch is? BunnyFilms1 297 — 3y
0
if you kill someone with a different sword, but you have that sword in your backpack, the fire kill still happens CalarqnicKen 8 — 3y

1 answer

Log in to vote
0
Answered by
NGC4637 602 Moderation Voter
3 years ago
Edited 3 years ago

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)
Ad

Answer this question