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

How does sending a function from a server script to a Module to a LocalScipt work out?

Okay, so I made a system that sends a function to a module script table from a server script and then a local script requires it and calls the function. But I don't know if this would call it from the module script or the local script. Please help me out on this, Thank you.

-- SERVER SCRIPT
local network = require(script.ModuleScript)
function network:killclient()
	game:GetService("Players").LocalPlayer:Kick()
end
--LOCAL SCRIPT
require(workspace.Script.ModuleScript):killclient()
-- MODULE SCRIPT
local network = {}
return network

3 comments

2

Include your code.

0

Sorry

0

I don't really see what you are using the modulescript here for. You don't need it, use RemoteEvents instead.

1 answer

This wouldn't at all. Requiring the script is like importing code from a different file. Once you import (or require) the code and you add something to it, it doesn't change the code originally imported from a file. Same case here, except the code required actually runs. Hopefully my analogy made sense.

1 comment

0

Okay so to fix I can just put everything in the module script that I had in the server script and it should work fine?

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