Calling External Functions

Sometimes, you may want to call functions defined by game script - for example, calling a network send function within a ModuleScript. Doing so is dangerous though as a clever game script developer can check its environment for suspicious properties. Synapse X luckily includes functions that automatically mitigate this issue though.

syn.secure_call

Synapse X defines the function syn.secure_call which will automatically handle securely calling an external function for you.

An example is provided below:

local Module = require(game:GetService("ReplicatedStorage").SomeModuleScript)
local LegitCaller = game:GetService("Players").LocalPlayer.PlayerScripts.SomeLocalScript

local Result = syn.secure_call(Module.FunctionToCall, LegitCaller, ...)
print(Result)

You simply pass the external function, a legitimate script that calls this function, and any parameters that the function needs. The rest is handled automatically for you.

Lets move on to the filesystem API now.