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

Golden Kill effect by Golden Sword is not working?

Asked by 3 years ago

Here is the script. Its not working. Please help me.

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

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.player.torso = ("VeryYellow")-- here, after said player dies is where the effect would be
        end -- check tool name
    end) -- Died
end) -- CharacterAdded

end) -- PlayerAdded

0
Can anyone help me please? Sorry if the text looks weird CalarqnicKen 8 — 3y
0
you can fix the text looking weird by selecting your script then putting in a code block. NGC4637 602 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago

Your mistake is very simple. Allow me to explain.

On this line, what is interpreted by Lua? The answer: Not what you'd think it would be.

local.player.torso = ("VeryYellow")

torso may refer to a value of key player, which in turn may refer a key of table local. Since there is no table named local, Lua stops and raises an error. There is also no key named player and no value of player named torso. In other words, you're doing it incorrectly.

If you meant to use BrickColor to refer to VeryYellow, you may use the Gold color. The player's Torso has a BrickColor property which specifies the torso's BrickColor. (All BaseParts share this property.) A BrickColor can be retrieved using the BrickColor.new() constructor function, which can take a string determining the BrickColor to use. In this case, you'd want Gold because you desire a golden kill effect. The fix here is to do Character.Torso, since Character refers to the player's character and is already specified from the CharacterAdded signal. Its BrickColor should be assigned to the Gold BrickColor.

0
thank you CalarqnicKen 8 — 3y
Ad
Log in to vote
-1
Answered by 3 years ago

Replace your script with the following:

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

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 _, v in pairs(Character:GetChildren()) do
        if v.ClassName == "MeshPart" then
            v.BrickColor = BrickColor.new("Gold")
            v.Material = Enum.Material.Neon
        end
    end
    end -- check tool name
    end) -- Died
end) -- CharacterAdded
0
-1, don't spoonfeed DeceptiveCaster 3761 — 3y
0
ok for the "MeshPart" im kinda new for scripting, when i put in torso, it doesnt work. CalarqnicKen 8 — 3y
0
Just write what is written. Trust me bro. Shounak123 461 — 3y

Answer this question