I Am Legitimately Stuck

So um…

I have absolutely no idea how to fix this. I need to access the children of an object value, but I’ve been told you can’t do that. (unlockableParts is the ObjectValue)

for i, child in ipairs(player:FindFirstChild('UnlockableParts'):GetChildren()) do
			if child:IsA('BasePart') then
				child.Transparency = 0
				child.CanCollide = true
			end
		end 
		
		
		for i, button in ipairs(player:FindFirstChild('UnlockableParts').Value.Base.Button.ArchitectButtons:GetChildren()) do

			button.Head.Transparency = 0
			button.Head.CanCollide = true
			button.Unlocked = true

		end

I can’t use game.Workspace. Is there a way to reference the children of an ObjectValue? Or is there another Value type I can use to solve this? Please help!

Try changing unlockable parts to a folder because I’m sure you can find the children of a folder object.

Yes, but I need to be able to reference it from the player.

Sorry I forgot to mention this in the post

So you are saying that this script is on the server? If it is, just add a folder to serverstorage with the player’s name

local Market = game:GetService('MarketplaceService')
local gamePassId = 16624321

-- give player a trail
local function makeAPartsAppear(player)
	print('wudup')
	local function partsAppear()
		
		
		for i, child in ipairs(player:FindFirstChild('UnlockableParts'):GetChildren()) do
			if child:IsA('BasePart') then
				child.Transparency = 0
				child.CanCollide = true
			end
		end 
		
		
		for i, button in ipairs(player:FindFirstChild('UnlockableParts').Value.Base.Button.ArchitectButtons:GetChildren()) do

			button.Head.Transparency = 0
			button.Head.CanCollide = true
			button.Unlocked = true

		end
		
	end
	game.StarterGui.ScreenGui.ShopScreen.GamePassFrame.TextButton1.MouseButton1Click:Connect(partsAppear)
	
	-- give the players character a trail immediately
	if player then
		print('eyyy')
		partsAppear()
	end
	
end

-- function to give the player their gamepass effect when they purchase in-game
local function purchaseComplete(player, purchaseId, purchaseSuccess)
	
	if purchaseSuccess == true and purchaseId == gamePassId then
		makeAPartsAppear(player)
	end
	
end
Market.PromptGamePassPurchaseFinished:Connect(purchaseComplete)


So here is the script. Can you expand on that a little bit more? I’m not entirely sure how to do that.

First, you want to create a function that will be run when the player joins.

local function onPlayerAdded(p)

end

In this function, you want to create a new folder, give its name to the player’s name, and parent it to server storage.

local function onPlayerAdded(p)
    local playerFolder = Instance.new("Folder")
    playerFolder.Name = p.Name
    playerFolder.Parent = game.ServerStorage
end

Then, you need an event listener that listens to .PlayedAdded

game.Players.PlayerAdded:Connect(onPlayerAdded)

Now, you want to add in your MakeAPartsAppear() function something that will get the folder from serverstorage using the players name.

(you can also use player.UserId, too)

Okay… one last thing. How do I get the parts (Part1, 2, ect) into a new folder that just got created?

This really depends on your system. I have no clue how the parts go in the object value that you had first made.

Also, if you are going to render the parts, parent the folder to workspace instead of serverstorage or clone the parts from serverstorage to workspace.

On line 1 were you getting the children of the physical ObjectValue or the ObjectValue’s Value children?