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

Code causing nil value error?

im trying to change the mesh of a players sword using findfirstchild, but i recieved a nil value error for the local

local Dd = plr.Backpack:FindFirstChild("ClassicSword")
	Dd.Handle.Mesh.MeshId = "http://www.roblox.com/asset/?id=201941127"

1 answer

More than likely is that Dd is nil, and you're trying to access it anyway.

Try using WaitForChild instead:

local Dd = plr:WaitForChild("Backpack"):WaitForChild("ClassicSword")
	Dd.Handle.Mesh.MeshId = "rbxassetid://201941127"

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