Problem with Module Scripts Requiring from Client

You can write your topic however you want, but you need to answer these questions:

I want to make it soo this modulescript can run since I really need it for my products for a studio i’m working for.

The issue is that I can’t run this modulescript from a localscript.
Error Image


local module = require(script.MainModule)

local ProductName = "Nusa | NPC System"

local GameOwner = nil

if game.CreatorType == Enum.CreatorType.Group then
	GameOwner = game:GetService("GroupService"):GetGroupInfoAsync(game.CreatorId).Owner.Id
elseif game.CreatorType == Enum.CreatorType.User then
	GameOwner = game.CreatorId

module:GetAsync(HubID, ProductName, GameOwner, function(Success, Value)
	if Success == true then
		print("Player does own product")
		print("Player does not own product")

This is something that you need to use RemoteEvents and RemoteFunctions for. ModuleScripts become the type of script that requires them. If a local script requires one, it will run as a local script. Not only are these APIs not accessible on the client, but permissions stuff like this needs to be handled on the server so that it is less vulnerable to hacking.

Define the use of RemoteEvents, I’m terrible at them.

It is a way for a LocalScript to send a message to a Script to ask it to do something. In this case, the important things (that I can see) are checking group ownership and product ownership. These are seen as sensitive information and need to be moved to a Script. A LocalScript can send a RemoteFunction if it needs to retrieve the information. I can’t give an example since I’m on mobile, but there are a lot of resources on RemoteEvents and RemoteFunctions. Look into those and if you have follow-up questions feel free to reply again.

1 Like

The problem now, your idea works, but now everyone has access to this product.

I won’t have time this morning myself, but share both of the scripts and we will help you sort it out. Good luck