Attempt to index nil

Hi, I am confused why I am getting the message “attempt to index nil with Pla”. In a server script, I make an object value equal to player. Then I turn a bool value on. Once the bool value is on, the local script code fires and sets a local variable, player, equal to the object value (which is the player). If this happens after I set the value, how can it be nil? If I go server side, it shows the object value to contain my name.

local _workspace = game:GetService("Workspace")
local up = _workspace.Up
local pla = up:WaitForChild("Pla") --up is the model, Pla the object 
pla.Value = player
ig.Value = true --bool value

local script

ig:GetPropertyChangedSignal("Value"):Connect(function()
	wait(0.5)
	local player = up.Pla.Value
``

Roblox is saying that the “up” variable is nil. This means that by the time the script runs, there is nothing called “Up” parented to the workspace.

1 Like