Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why wont this script find a ModuleScript named shop?

Im confused.

There is a module script in server script service. Its name is shop.

My (local) script:

local ServerScriptService = game:GetService("ServerScriptService")
local Module = require(ServerScriptService.Shop) --The problem.

function onClick()
	Module:PurchaseAnthem(game.Players.LocalPlayer, script.Parent.Parent.Id.Value, script.Parent.Parent.Price.Value)
end

script.Parent.MouseButton1Click:Connect(onClick)

When I try to get the module it doesn't work and I get an error in the output: "Shop is not a valid member of ServerScriptService "ServerScriptService"

2 comments

1

LocalScript(Client) cannot access the Server. These services are ServerScriptService and ServerStorage. The best place to store modules is ReplicatedStorage. Client and Server can access this service.

0

Ty

1 answer

✓ Accepted answer

This is because its in ServerScriptStorage. As soon as the game is run, anything inside there gets sent somewhere else. You can use ReplicatedStorage instead, it works that way.

1 comment

0

ty

This discussion is preserved as it was. New answers, comments, and votes are closed.