Hi there !
I am trying to use bindable event to tell a script to load a map, then that map loader will fire it back to tell the first script that it has finished loading the map.
Sadly, i can only fire it one way. I can tell the map loader to fire the event, but when i try to fire it back, it just does not fire. (No errors or anything)
Here is the first script:
local MapLoaded = false
local function FilterFunction(Recipient)
if Recipient == "MapLoaded" then
MapLoaded = true
wait(1)
MapLoaded = false
end
end
GameLoopBindable:Fire("LoadMap")
repeat wait() until MapLoaded == true
--Continue the script
GameLoopBindable.Event:Connect(FilterFunction)
And here is the map loader script:
local function LoadMap()
print("Would load map")
--Load map here
GameLoopBindable:Fire("MapLoaded")
end
local function FilterFunction(Recipient, Argument1)
if Recipient == "LoadMap" then
LoadMap()
end
end
GameLoopBindable.Event:Connect(FilterFunction)