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

Golden Kill effect by Golden Sword is not working?

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

2 comments

0

Can anyone help me please? Sorry if the text looks weird

0

you can fix the text looking weird by selecting your script then putting in a code block.

2 answers

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.

1 comment

0

thank you

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

3 comments

0

-1, don't spoonfeed

0

ok for the "MeshPart" im kinda new for scripting, when i put in torso, it doesnt work.

0

Just write what is written. Trust me bro.

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