Problem with requiring modulescript

Hello I am currently working on an egg hatching system but ran into an error saying
PetsModuleScript is not a valid member of ServerScriptService “ServerScriptService” - Client - LocalScript:77
but the module script is there
Screenshot 2022-02-05 172641

Here is the script
MODULE SCRIPT

local Pets = {
	Cat = game.ReplicatedStorage.Pets.BasicEggPets.Cat:Clone();--30 common
	Dog = game.ReplicatedStorage.Pets.BasicEggPets.Dog:Clone();--30 common
	Mouse = game.ReplicatedStorage.Pets.BasicEggPets.Mouse:Clone();--20 uncommon
	Dragon = game.ReplicatedStorage.Pets.BasicEggPets.Dragon:Clone();--15 rare
	GrassyCat = game.ReplicatedStorage.Pets.BasicEggPets.GrassyCat:Clone();--4 epic
	TeaMonster = game.ReplicatedStorage.Pets.BasicEggPets.TeaMonster:Clone()	--1 legendary

	
}



-- add a folder with all the pets that will be stored in it.
--Rarity,Power,Equipped or Not, ownership


return Pets

Here is the local script which the module script is returning to
LOCAL SCRIPT

local function PetPicker()
			local Pets = require(game.ServerScriptService.PetsModuleScript)-- the script errors here
			
			local PetHatchedScreenUI = game.Players.LocalPlayer.PlayerGui.PetHatchedScreenUI
			local PetViewPortFrame = PetHatchedScreenUI.Frame.PetViewPortFrame
			local Rarity = PetViewPortFrame:WaitForChild("RarityTextBox")
			local PetName = PetViewPortFrame:WaitForChild("PetNameTextBox")
			
			
				local petChance = math.random(1,100)
			print(petChance)
			if petChance <=30 then
				Pets.Cat.Parent = PetViewPortFrame
				Rarity.Text = "Common"
				PetName.Text = "Cat"
				
			end
				
			end
		
		PetPicker()
		
		
	else
		print("Player Can't Buy This Egg")
		local EggErrorGui = game.Players.LocalPlayer.PlayerGui.EggErrorGui
		EggErrorGui.Enabled = true
		wait(5)
		EggErrorGui.Enabled = false
		
	
	end
end)

If you have any question concerning the script I will be open to answer them.

ServerScriptService is only server-sided and can’t be seen by the clients.
If you want the client to have access to the module script you must put it somewhere like in ReplicatedStorage

1 Like