Script runs fine but some stuff doesn't go to their named place

So basically the script is suppose to place the named folder to there named places like game.Lighting folder stuff goes in lighting. SOOOOOO the serverscriptservice and serverstorage folders doesn’t go to their named places how the others do how can I fix this?

local model = game.ServerStorage:WaitForChild('GameFiles')
if model then
	print("Model loaded successfully")
	model.Name = 'Files'
	model.Parent = game.ServerStorage
	for _,Folders in pairs(model:GetChildren()) do
		for _,Assets in pairs(Folders:GetChildren()) do
			if Folders.Name ~= 'StarterPlayer' then
				Assets:Clone().Parent = game[Folders.Name]
					print('Base Player Module Destroyed')
				for _,StarterFolders in pairs(Assets:GetChildren()) do
					StarterFolders:Clone().Parent = game.StarterPlayer[StarterFolders.Parent.Name]
	local MainModule = require(game.ServerScriptService:WaitForChild('MainModule'))
	local PlanetList,Coordinates,PlanetNames,GravityList = MainModule.PlanetList()
	script.Planet.Value = PlanetList[game.PlaceId]
	print('Planet: '..script.Planet.Value)
	print('Assets have sucessfully been placed.')
	script.FilesLoaded.Value = true
	print("Model failed to load!")

for i,v in pairs(game.Players:GetPlayers()) do
	if v:FindFirstChild('Ki') == nil then
		local z ='IntValue')
		z.Name = 'InfoNeeded'
		z.Parent = v
		print(v.Name..' started the server')

Is this a LocalScript?
Clients don’t have access to serverscriptservice or serverstorage which is why they wouldn’t be placing the folders there if that’s the case.

serverscript not a local script

This looks familiar…
Try maybe putting the MainModule in ServerScriptService

I tried this soooooo many times so im running the modules from replicatedstorage now

Try making sure that your Datastore script and your MainModule are both going to be in ServerScriptService. Putting modules in ReplicatedStorage is normally not a big deal I did that with most of my previous games but I don’t anymore due to organizations sake

yea sadly my datastore module is infinite yield rn but the main is fine

local MainModule = require(game.ReplicatedStorage:WaitForChild('MainModule'))
local DataStore = require(game.ReplicatedStorage:WaitForChild('DataModule'))
local PlanetList,Coordinates,PlanetNames,GravityList = MainModule.PlanetList()
local Planet = PlanetList[game.PlaceId]
game.ServerStorage.ServerSettings.Gravity.Value = GravityList[Planet]

		plr:WaitForChild('Stamina').Value = 1000

DataModule and MainModule should not be in the game files, they need to be in their respective locations before the assets are copied in. I would also recommend just ungrouping your files model and copy and pasting them all into their locations.

A much better alternative to using insert service or simply copy and pasting files in is to save everything to a package, they automatically update when changed. Here is some more info on that:

wont work i tried that aswell doing a different approach

1 Like