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
Code
local module = require(script.MainModule)
local HubID = "NOT BEING SHOWN"
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
end
module:GetAsync(HubID, ProductName, GameOwner, function(Success, Value)
if Success == true then
print("Player does own product")
else
print("Player does not own product")
script:Destroy()
end
end)
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.
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. https://developer.roblox.com/en-us/api-reference/class/RemoteFunction