Hello.
I have a simple Script in a BindableFunction in ServerStorage with the code:
script.Parent.OnInvoke = function() print(1) end)
However, when trying to call it (from a Script of course), it pauses the entire script's execution and doesn't print anything.
I'm calling it simply with :Invoke().
Why does it pause the entire script? Is it because it's in ServerStorage?
ServerStorage was basically created to replace the Lighting service in terms of storing items you did not actually want shown in your game. This also means (like the Lighting service), any script that's a descendant of ServerStorage will not execute (same goes for ReplicatedStorage).
This means the code you wrote to initiate the callback isn't running, which means you're calling Invoke
on a BindableFunction
that has no function. This is what's causing the infinite pause after you call Invoke.
Easy fix, just have the script that's initiating the callback be somewhere else in your game (preferably the ServerScriptService since it's a server script). Example:
-- Script that's in the ServerScriptService local ServerStorage = game:GetService("ServerStorage") local BindableFunction = ServerStorage:WaitForChild("Function") BindableFunction.OnInvoke = function(...) print(...) end
The code above will now run, and you should no longer have an infinite yielding problem. If you have any questions, just let me know.