Hello. So I'm creating a GUI, which contains a LocalScript, a server Script, and a RemoteFunction in a FilteringEnabled game. For whatever reason, whenever I call InvokeServer in the LocalScript, it is just freezing - no error, no callback, if I call print after the invoke, nothing happens, but just before it works fine. Even doing extremely basic things on the server end causes it to freeze.
The hierarchy looks like this:
ScreenGui
(There's more things but they're irrelevant, I made sure that it the LS is in fact being executed)
-Frame
--LocalScript
--actuate (RemoteFunction)
--Script
--A bunch of GUI objects that aren't relevant to this
Consider the following code I was using to test it:
LocalScript
--Obviously this isn't all it does, I'm just using this to test print(1) script.Parent:WaitForChild("actuate"):InvokeServer() print(2)
Server Script:
--As with the above, this is just to test function script.Parent.actuate.OnServerInvoke(plyr) print("CALL") return true end
1
That's all it prints, as I said there's no errors, callbacks, anything. Weirdly, it works in Solo test mode in Studio, but it fails in Local Server testing. Additionally, I've used these before and they work totally fine, but now it just seems to stop working.
Your code is fine. Your setup isn't.
Your RemoteFunction should be in ReplicatedStorage, so that both the server and the client can access it.
Your Script should be in ServerScriptService, so that it can run on the server.
Your LocalScript and Script need to reference the RemoteFunction from ReplicatedStorage
local actuate = game.ReplicatedStorage.actuate; print(1) actuate:InvokeServer() print(2)
local actuate = game.ReplicatedStorage.actuate; function actuate.OnServerInvoke(plyr) print("CALL") return true end