Answered by
5 years ago Edited 5 years ago
Client-Server separation
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:
1 | local Remote = game.ReplicatedStorage.RemoteEvent |
2 | script.Parent.MouseButton 1 Click:Connect( function () |
ServerSide:
1 | local Remote = game.ReplicatedStorage.RemoteEvent |
2 | Remote.OnServerEvent:Connect( function (plr) |
3 | local storage = game:GetService( "ServerStorage" ) |
4 | local part = storage.TestPart:Clone() |
5 | part.Parent = workspace |
Remote events, in general, should be put inside ReplicatedStorage, which, unlike ServerStorage, replicates to the client.
Links
For more info on remotes, try looking at these links:
Remote Events api-reference page
Remote functions and events
Hopefully this helped!