local module = {}
function module.start()
local actor = script:GetActor()
actor:BindToMessageParallel("idek", function(data)
print(data)
end)
print("bind")
end
return module
the function runs in the context of the script you required it from
but if you require it and run the code in the module script without a function its gonna run from the context of it being under an actor (since the module script is under an actor)
basically functions run under the script context and not the module
You try to communicate to a diffirent VM without using proper channels such as BindableEvent/Actor API
Its obviously not possible; Don’t do that.
Instead turn this module into a regular script and communicate to script through Actor
You seem to not undestand how Actor and ModuleScript works.
Also what is the point of having this function anyway?
local actor = script:GetActor()
actor:BindToMessageParallel("idek", function(data):()
print(data)
end)
print("bind")
return nil
Would make more sense
Solution:
Turn ModileScript into a regular script
local actor = script:GetActor()
actor:BindToMessageParallel("idek", function(data):()
print(data)
end)
print("bind")
actor:SetAttribute("Init",true)
Calling:
local Actor = game.ServerScriptService.Actor
if not Actor:GetAttribute("Init") then Actor:GetAttributeChangedSignal("Init"):Wait() end
Actor:SendMessage("idek","Hello")