Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why can I not access ServerStorage from a Module script?

So I wanted to load levels in my game via a local script originally. Then I realised this would mean the levels couldn't be in ServerStorage as the client cannot see objects within it.

So I decided to use a Module to load in the level: This is called when a button is clicked in players GUI

function loadLevel(levelid)
	if Workspace:FindFirstChild(levelid) == nil then
		Level = game.ServerStorage:FindFirstChild(levelid):Clone()
		Level.Parent = Workspace
		
	end
end

return loadLevel

This works fine in solo but online it says that ServerStorage isn't a member of DataModel etc etc, so is there a way to load in levels from ServerStorage taking input from localscripts?

Or would I just have to replace every localscript in the buttons to scripts? (which works but isn't really what I wanted to do because I prefer to use game.Players.LocalPlayer)

1 answer

✓ Accepted answer

I believe you may have to change the script type, as in Play Solo it allows both Local and Regular script types to function as normal.

1 comment

0

Yeah, change it to a regular script or use RemoteFunctions. ServerStorage is used for storing server-only instances.

This discussion is preserved as it was. New answers, comments, and votes are closed.