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

Code causing nil value error?

Asked by 9 years ago

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

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
9 years ago

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

Answer this question