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

Script can't access anything in ServerStorage???

Asked by 4 years ago
Edited 4 years ago

My LocalScript in StarterGui errors "Stormy_Sky is not a valid member of ServerStorage" when it is. LocalScript:

local Status = game.ReplicatedStorage:WaitForChild("Status")
local clonedSky

if game.ServerStorage.Stormy_Sky then
    print("Yes.")
end
Status:GetPropertyChangedSignal("Value"):Connect(function()

    if Status.Value == "Game in progress." then
        clonedSky = game.ServerStorage.Overcast:Clone()
        print(clonedSky)
        clonedSky.Parent = game.Lighting
        clonedSky.Name = "Overcast"
        game.Lighting.ClockTime = 1
    else
        if game.Lighting.Overcast then
            game.Lighting.Overcast:Destroy()
        end
        game.Lighting.ClockTime = 12
    end

end)

Do I need to change it to a Script?

PS. It won't print "Yes."

0
Explanation: I want this script to change the sky and time when a round starts. NickIsANuke 217 — 4y
0
put what ever you want it to get in the lighting 3wdo 198 — 4y
3
A localscript is a client sided script. If you are wanting to access serverstorage(this is serversided) you need to either be in a script or use a remote event. ForeverBrown 356 — 4y
0
Put it in Replicated Storage as this replicates to the client and allows the client to access it. royaltoe 5144 — 4y
View all comments (2 more)
0
i put an answer, see if it helps. EmbeddedHorror 299 — 4y
0
It doesn’t need to be a local script. Also, @AlbertoMiAmigo2 I want it to change the sky box between default (no skybox) and Stormy_Sky NickIsANuke 217 — 4y

3 answers

Log in to vote
2
Answered by 4 years ago
Edited 4 years ago

ServerStorage is for the server only, so localscripts are not able to access it. Localscripts do, however, have access to replicated storage. If what you are doing needs a localscript to work, you should use a remote event.

edit: If it doesn't need to be a localscript then make it serverside and leave it as is.

0
Best answer here. Ignore below answers as they are impractical sahadeed 87 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Strange, I've been testing works yes ! try putting the script in ServeScriptService

PRINT: http://prntscr.com/p8pj9b

0
Put it in Replicated Storage as this replicates to the client and allows the client to access it. royaltoe 5144 — 4y
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

is it a local script?

when yes, local scripts can't acces serverstorage.

use a Script instead or put it in replicatedstorage

0
give an alternative EmbeddedHorror 299 — 4y
0
script SuperAstroGame -2 — 4y

Answer this question