PlaceID returning nil

I’m making a script that essentially lists all places via their names and ID’s. I can tell that it’s properly getting the places as their names are returning, however the place.PlaceID is always nil

The Code (The buttons themselves are irrelevant to the issue)
local AssetService = game:GetService("AssetService")

local Create_UI_Elements_From_Array do
	
	local countNumber = 0
	
	local game_Place_Pages = AssetService:GetGamePlacesAsync()
	
	
	while true do
		
		for _,place in ipairs(game_Place_Pages:GetCurrentPage()) do --Iterates through the current API page of places, making a button for each
	
			countNumber = countNumber + 1
	
			local Set_Up_Button_Clone do
				buttonClone = script.Parent.Placebutton_Template:Clone()

				buttonClone.Parent = script.Parent
				buttonClone.Name = "Place_Teleport_Button"
				
				buttonClone:SetAttribute("PlaceID_To_Request", place.PlaceID)
			end

			
			local Set_Button_Text do
				text = buttonClone.Text
				
				print(place.PlaceID)
				--text.Text = (place.Name .. " : " .. tostring(place.PlaceID)) --Sets the text in the format ("Place_Name : Place_ID")
			end
	
	
			buttonClone.Visible = true
		end
			
		if game_Place_Pages.IsFinished then --Breaks if there are no pages left
			break
		end

		game_Place_Pages:AdvanceToNextPageAsync() --Scrolls to the next page of the API
	end
end

I’ve tried making the game public, but that doesn’t seem to help with the returns, and as far as I can tell, place.PlaceID is the proper method for getting PlaceIDs.

(Also this is in a localscript in case that helps)

Maybe you should define the function outside the while true do loop.
Meaning, Instead of

while true do
  local foo do
    --something
  end

  --something else
end

Do

local function foo()
  --something
end

while true do
  foo()
  --something else
end

The local thing do blocks aren’t really functions, I just use them for organizing my code.

Nvm, found the issue, it’s PlaceId not PlaceID, I apparently somehow misread the documentation multiple times in a row, including on my double checking.

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