I'm working on a GUI, and I'm using BindableFunctions for communications between the server and the client. For some reason, an OnInvoke function will not work in a specific frame within the GUI, while the same code will work properly in a different frame.

The LocalScript that doesn't run the code properly is under 4 frames, while the one that does work is the child of one frame (whose parent is the ScreenGui). I'm not sure if this has anything to do with why it won't work.

Here's the code:

function game.ReplicatedStorage.GraphicsChange.OnInvoke(Name)
	if Name ~= script.Parent.Name then return end -- the name should be the same
	local focusedImage = game.ReplicatedStorage.Images:findFirstChild(script.Parent.Name)
	if focusedImage == nil then return end
	script.Parent.ImageID.Value = focusedStock.ImageID.Value
end

The BindableFunction is invoked properly by a script within the Workspace. I know that a LocalScript can successfully listen for an invoke using the code presented above. I simply do not know why it won't work in another script.

Thank you for your time.

1 comment

0

You need to use remote events / functions for server -> clinet or client -> server. BindableFunctions are used for script -> script not for client -> server ect