I'm making a script where when a gui button is pressed on screen, a tool from ServerStorage is cloned and goes to the player's backpack. The script works in studio test mode, but when playing the published game, I get the error "ServerStorage is not a valid member of Data Model". How do I access the Server Storage from the PlayerGUI? Here is the script.
function give(x) local y = script.Parent.Parent.Parent.Parent.Parent.Backpack --Player's Backpack local z = game.ServerStorage["Receipt"] --Problem Area z:Clone().Parent = y local gui = y.Parent.PlayerGui.OrderSystem.Order gui:Clone().Parent = y.Receipt.Tools local newGui = y.Receipt.Tools.Order --Ignore from here on newGui.Cancel.Visible = false newGui.ImageButton1.Visible = false newGui.ImageButton2.Visible = false newGui.ImageButton3.Visible = false newGui.ImageButton4.Visible = false newGui.Done.Visible = true end script.Parent.MouseButton1Click:connect(give)
ServerStorage is only accessible via the Server. That is why it's called 'ServerStorage'.
If you want a client to access something, then put it in 'ReplicatedStorage'. This storage both the Server and the Clients can see.
Note: Remember that you also need to use a LocalScript inside the Gui.