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

attempt to index nil with 'Value'?

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

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.

3 comments

0

oh let me try that

0

wait im not using it in a variable there is a waitforchild(...Value)

0

i meant findfirstchild

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.

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