Module not requiring or proximityprompt script not working?

I’m making an egg hatch system and im using a proximity prompt for the hatch to make life easier but it isnt working. I think I’m missing something.

Prox Prompt Localscript:

local proxprompt = script.Parent
local module = require(game.Players.LocalPlayer.PlayerGui.EggGui.EggModuleClient)

	module:RequestHatch(plr, proxprompt.Parent)


local eggs = {}
local Viewport = script.Parent.EggViewportFrame
local ScrGui = script.Parent
local camera = ScrGui.Camera -- i just duplicated the workspace camera lol

function eggs:RequestHatch(plr: Player,egg: Instance)
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = (egg.CFrame.LookVector * 10) -- ten probably wont be final, just testing
	camera.CameraSubject = egg
	local ViewportItem = egg:Clone()
	ViewportItem.Parent = Viewport.Container -- Container is a worldModel
	for i,v in pairs(ViewportItem:GetDescendants()) do
		v:Destroy() -- the descendants are the proximityprompt and the localscript which i dont want in there

return eggs

Next time, please provide more information like whether there is an error message or not.

I’m pretty sure LocalScripts cannot run under workspace, and I am assuming your LocalScript is a descendant of workspace. Therefore, the problem may be that your LocalScript is a descendant of workspace.

You can probably fix this by relocating the LocalScript to somewhere like StarterGui or StarterPlayerScripts and change the path for the ProximityPrompt.

Well, there were no errors. I also tried to put it in starterplayerscripts (obviously changed the path to proximity prompt) but all it said was that DefaultEgg did not exist in workspace.Eggs when it did

Perhaps use :WaitForChild() and check your spelling.

Interesting, I got 2 new errors
"Camera is not a valid member of ScreenGui “Players.DevYeetaludedus.PlayerGui.EggGui” (i checked and it seemed to be that the camera disappears out of the screengui?)

“Requested module experienced an error while loading” (makes sense)

Hmm, do you know why the camera is missing? You sure the camera was there in the first place?

I can give you the hierarchy

Try using WaitForChild() for the camera, it might be calling for it before it’s loaded

im not sure that would be much help

ok i just tried it it just warns me that theirs an infinite yield possible which is never good