Please don’t do this. ClickDetectors can be connected to from the client as well. If everything here is client-based, you should be handling all this logic from the client.
The server has no reasons to waste resources facilitating this interaction.
@TheCarbyneUniverse@roseblade578
There isn’t much point involving the server for this sort of thing unless it is crucial that you have to. The servers memory should be saved for things like DataStores, Matchmaking ect. This brings me onto say that it is possible to make this whole system client sided with not many changes.
First you will need to create a LocalScript and place it anywhere on the client, preferably in StarterGui in the shop GUI. Here is a little image of the setup below:
Once you have a setup similar to that you will need to put the code into the LocalScript. I have tweaked your code slightly to make it work client sided as shown below:
local ShopPart = workspace.Shop -- Where the shop is located in workspace
ShopPart.ClickDetector.MouseClick:Connect(function()
if not script.Parent.Frame.Visible then
script.Parent.Frame.Visible = true
end
end)