Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why can I not access ServerStorage from a Module script?

Asked by 9 years ago

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

Log in to vote
0
Answered by 9 years ago

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.

0
Yeah, change it to a regular script or use RemoteFunctions. ServerStorage is used for storing *server-only* instances. gskw 1046 — 9y
Ad

Answer this question