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

attempt to index nil with 'Value'?

Asked by 3 years ago
wait(5)
while true do
    if script.Parent.Parent.SelectedSeed ~= nil then
        wait()
        local plr = game.Players:FindFirstChild(game.Workspace:FindFirstChild("PlayerName").Value)
        local seed = plr:FindFirstChild("Plants"):FindFirstChild(script.Parent.Parent.SelectedSeed.Value)
        script.Parent.Text = "You Own "..seed.Value
    end
end

i know this is a pretty bad script but for some reason im getting this error: 18:51:33.001 - Workspace.Tycoon.BioGarden.Tablet1.Ekran.Menu.Info.Count.Script:7: attempt to index nil with 'Value'

2 answers

Log in to vote
0
Answered by 3 years ago

You are already using .Value in the variable so what you are effectively doing is seed.Value.Value so it errors with nil since .Value is not a child of .Value. Just remove one of the .Value's and it will work.

0
oh let me try that TFlanigan 86 — 3y
0
wait im not using it in a variable there is a waitforchild(...Value) TFlanigan 86 — 3y
0
i meant findfirstchild TFlanigan 86 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

I found you error:

In your :FindFirstChild(), you are looking for SelectedSeed.Value, which isn't a thing. You want to get rid of the .Value in line 6.

Answer this question