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!
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.
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.