Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago
Edited 5 years ago

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
2
Include your code. xPolarium 1388 — 5y
0
Sorry ConnectionOffline -5 — 5y
0
I don't really see what you are using the modulescript here for. You don't need it, use RemoteEvents instead. exxtremestuffs 380 — 5y

1 answer

Log in to vote
0
Answered by
poke7667 142
5 years ago
Edited 5 years ago

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.

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? ConnectionOffline -5 — 5y
Ad

Answer this question