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

LocalScripts aren't working with ServerStorage?

Asked by 6 years ago
Edited 6 years ago

In LocalScripts I can't access things like ServerStorage, ServerScriptService, or Players sometimes. Is this just something that happens, or is it a bug? (I'm making an admin GUI, but it's finished) Hope someone can help here.

game:GetService("ServerStorage")
game.ServerStorage:FindFirstChild("adminGUIdb")
bin = script.Parent
function Click()
    local gui = game.Workspace.adminGUI2 --See, I must use Workspace in a LocalScript
    local p = game.Players.LocalPlayer
    if bin.open.Value == 0 then
        gui:Clone().Parent = p.PlayerGui
        script.Parent.Text = "Close R1"
        bin.open.Value = 1
    elseif bin.open.Value == 1 then
        p.PlayerGui.adminGUI2:Destroy()
        script.Parent.Text = "Open R1"
        bin.open.Value = 0
    end
end

bin.MouseButton1Click:connect(Click)

I can access Workspace, and that is my current method. EDIT: I am using a LocalScript.

0
You aren't suppose to be able to access ServerStorage or ServerScriptService with localscripts tkddude2 75 — 6y
0
Use ServerScripts. LocalScripts are supposed to be in StarterGui,StarterPack,orStarterPlayer. Mr_MilkysButler 47 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Local scripts cannot access ServerStorage or ServerScriptService. It is in the name of both "Server", you have to use a server script to access these items.

0
I had this before. Instead of putting the GUI into server storage, put it into ReplicatedStorage. Only non local scripts (server scripts) can access the ServerStorage and ServerScriptService. hellmatic 1523 — 6y
Ad

Answer this question