"Part" is not a valid member of model "workspace.spawn.part"

Hey Forum! I just came across a bug in my game and it sometimes disables the fact that a player can open a shop in game.

local BadgeStoreOpener = game.Workspace.Shop200m.BadgesGuiOpener
local BadgesGui = script.Parent
local ExitButton = BadgesGui.ExitButton
local BadgeService = game:GetService("BadgeService")

My Error: BadgesGuiOpener is not a valid member of Model “Workspace.Spawn.BadgesStore”

NOTE: a lot of these bugs happen when you spawn far away from the object.

I have also already did the streaming mode thing to my models and set them all to “atomic”

Still may be related to streaming enabled.

Can you please try replacing

game.Workspace.Shop200m.BadgesGuiOpener

with

game.Workspace:WaitForChild("Shop200m"):WaitForChild("BadgesGuiOpener")

and see if that fixes it?

I now just get the infinite yield possible error

It’s a warning, not an error. It just means that it didn’t instantly find it. Does the rest of the script work when you get close to the badge opener thingy

It does still work as intended! I just wanted to fix this bug because my friend had rejoined and the shop just wouldn’t open. Thanks!