I am trying to make one script call a function in another script. Both scripts are global scripts and non of them is a local script, using a remote event/function is not an option.
Yes, I know about module scripts, but they don’t fit what I need as the calling script is constantly being cloned forever (with delay between cloning of course).
I also don’t want to use _G and Shared because it would open a huge backdoor for exploiters, which I of course don’t want at any cost.
Any ideas how I may be able to make it work?
.
.
The caller script:
local reciever = game.Workspace.Conveyor:WaitForChild("Script")
function InterscriptCommunication_Test_Caller()
print("before calling")
-- call the function in the reciever script, sending to it script.Parent as an argument
print("after calling")
end
while wait(1) do
InterscriptCommunication_Test_Caller()
end
.
.
The reciever script:
local timesCalled = 0
function InterscriptCommunication_Test_Reciever(item:BasePart)
print("recieved")
timesCalled += 1
return timesCalled
end