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

Can someone explain why my Linked sword kill effect isn't working?

Asked by
Nixlex 0
1 year ago

So I've been trying to make kill effects for my game, but it seems the vanish kill effect is bugged. I have the script in a local script under the tool name "Forcefield" which is the name of the weapon.

When I test and kill someone the kill anchors, but other than that it doesn't seem to work.

Here's the script:

local Players = game:GetService('Players')
local toolName = 'Forcefield'

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

                for i, v in pairs(workspace:WaitForChild(script.Parent.Name):GetChildren())do
                    if v:IsA("Accessory") then
                        v.Handle.Anchored = true
                    elseif v:IsA("MeshPart") then
                        v.Anchored = true
                    elseif v:IsA("UnionOperation") then
                        v.Anchored = true
                    elseif v:IsA("Part") then
                        v.Anchored = true
                    end
                end
                for i = 1,20 do
                    wait(0.0025)
                    for i, v in pairs(workspace:WaitForChild(script.Parent.Name):GetChildren())do
                        if v:IsA("Accessory") then
                            v.Handle.Transparency = v.Handle.Transparency + 0.05
                        elseif v.Name == "Head" then
                            v.Transparency = v.Transparency + 0.05
                            v.face.Transparency = v.face.Transparency + 0.05
                        elseif v:IsA("MeshPart") then
                            v.Transparency = v.Transparency + 0.05
                        elseif v:IsA("UnionOperation") then
                            v.Transparency = v.Transparency + 0.05
                        elseif v:IsA("Part") then
                            v.Transparency = v.Transparency + 0.05
                        end
                    end
                end
            end
        end) 
    end) 
end) 

Can anyone explain what I have done wrong so I know what to keep in mind in the future? Please and thank you.

Answer this question