Hello there, I'm trying to make a GUI that will clone a part in ServerStorage then move it to Workspace. For some weird reason, it just says "TestPart is not a valid member of ServerStorage".
Here's my script(It's a local script in the button):
script.Parent.MouseButton1Click:Connect(function() local storage = game:GetService("ServerStorage") local part = storage["TestPart"]:clone() -- Change "Part" to the part name. part.Parent = game.Workspace end)
This is because the client can't access anything in ServerStorage or ServerScriptService, for safety purposes, what you should do is use a remote event to communicate between client and server, like such
Client Side:
local Remote = game.ReplicatedStorage.RemoteEvent script.Parent.MouseButton1Click:Connect(function() Remote:FireServer() end)
ServerSide:
local Remote = game.ReplicatedStorage.RemoteEvent Remote.OnServerEvent:Connect(function(plr) local storage = game:GetService("ServerStorage") local part = storage.TestPart:Clone() part.Parent = workspace end)
Remote events, in general, should be put inside ReplicatedStorage, which, unlike ServerStorage, replicates to the client.
For more info on remotes, try looking at these links:
Remote Events api-reference page
Hopefully this helped!