Objectvalue returning nil inside a localscript

hi devforum. I’m currently trying to script a system that automatically plays different playlists for every boombox in my game. I use objectvalues inside a folder in replicatedstorage to store the location of each boombox

I’m attempting to loop through every objectvalue and store it’s value inside of a table.

Fyi, this is a Localscript inside of StarterPlayerScripts

local rs = game:GetService("ReplicatedStorage")

local children = rs:WaitForChild("BoomboxLocations"):GetChildren()
local boomboxes = {}

for _, v in pairs(children) do

	if v:IsA("ObjectValue") then
		table.insert(boomboxes, v.Value)


The children table does work as intended, no problem there. For some odd reason though, after printing the boomboxes table, nothing is inside it. After trying to print v.Value inside of the loop, it gives me nil. Essentially, the objectvalue is returning nil, even though in the Explorer it’s clearly set.


I’ve attempted to move the location of the objectvalues plus parent folder around, for example, to be parented to this localscript inside of starterplayerscripts, or to be inside of replicatedstorage (above), however, it still doesn’t change a single thing.

After scouring through the devforum, I haven’t been able to find a proper solution to specific use case, so help would be very appreciated!! :pray::pray: Thx in advance


ReplicatedStorage is among the first things that loads when your game starts. Before your ObjectValues can even realize that they have object values assigned to them (that is still about to load), your script in StarterPlayerScript gets to load first and when it checks for the values, nothing is there. yet. Atleast, that’s my theory.

1 Like

if the value is pointing to an object that exist in the server it will return nil make sure the objects is in a shared place

1 Like

Alright, i added a task.wait before it gets the children, and it seems to work just fine now. Weird, I thought i did that before, but okay, it is what it is. A very odd oversight. Appreciate the answer!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.