i have this problem with my script it wont let me execute the ModuleScript that the serverscriptservice is executing but i keep getting an error here's my code:
local wow = script script=Instance.new'SelectionBox' local script = wow local module = {}function module(player) script.oofer_gang:Clone().Parent = game:GetService('Players'):FindFirstChild(player).PlayerGui _G.test = player end return module
can you help me plz?
Edit: New Problem's 'Requested module experienced an error while loading' or 'attempt to call a table value'
Not sure what you're using a global variable for, but you can access variables 'globally' by requiring a module script. also, you forgot to put module infront of your function because what you're doing is creating a function inside of a table called module.
selectionBox = Instance.new'SelectionBox' selectionBox.Parent = game.Workspace.Part -- parenting the selectionbox to a part in the workspace local module = {} module.myVar = "test variable" function module.myFunction(player) script.oofer_gang:Clone().Parent = player.PlayerGui _G.test = player end return module
you can access these functions by doing the following in a normal script:
--if your module is in the script service, reference like this vvv myModule = require(game.ServerScriptService.myModule) print(myModule.myVar) myModule.myFunction(game.Players.royaltoe) -- calling the function with a player instance as it's parameter
I think your error might be something to do with the player not being passed in correctly or because our function isn't actually inside the modle script. This should change things and make it work.
found the answer
local module = {} script.oofer_gang:Clone().Parent = game.StarterGui return module
quite simple idk y i didnt see it before but its fine now thanks for the help tho