I'm getting 'is not a valid member of Model' after turning StreamingEnabled on

I’m getting this error:

Error

I triple-checked and it’s 100% a member, it doesn’t work when because of streamingEnabled. But when I turn it off it works fine. I think it’s because the ‘part’ hasn’t loaded in. Help, here’s the code below.

local MarketplaceService = game:GetService('MarketplaceService')
local module = require(game.ReplicatedStorage.Donations)
local plr = game.Players.LocalPlayer

local board = game.Workspace.Donation_Board
local buttons = board.Buttons.SurfaceGui.Frame:GetChildren()

for i,b in pairs(buttons) do
	b.MouseButton1Click:connect(function()
		game.ReplicatedStorage.donation:FireServer(b.Id.Value)
	end)
end	

try using :WaitForChild(“Buttons”)

i.e.

local buttons = board:WaitForChild("Buttons").SurfaceGui.Frame:GetChildren()
2 Likes