Difficulty communicating between two local scripts

  1. What do you want to achieve? Keep it simple and clear!

Communication between two local scripts.

  1. What is the issue? Include screenshots / videos if possible!

The scripts are for a menu system, I have a Surface GUI in starter GUI, adornee is set to an object that my camera is looking at, there is a local script underneath the image button, (purple dot in image 1) which can functionally detect when the button is pressed, and :Fire()s the bindable event, with a test case, I confirmed that scripts works, just fine.

The other script, located under starterGUI aswell, (red dot image 2) is supposed to receive the bindable event, but it does not.

image
image

  1. What solutions have you tried so far?
    Using bindable functions and remote events instead, I’ve looked for other solutions and I am aware there are multiple posts about this, but all of the solutions given I have already applied.

Script under image button.

local btn = script.Parent
local RS = game:GetService("ReplicatedStorage")
local Event = RS.MainMenuEvents.TeamsClicked
btn.Activated:Connect(function()
	Event:Fire()
	print("Sent")
end)

Receiver portion of other script.

local TeamsClicked = RS.MainMenuEvents.TeamsClicked

TeamsClicked.Event:Connect(function()
	print("Received")
end)
1 Like

looking at the title of your post the first thing i noticed is that you are using two local scripts , where you could use only one that would do both stuff easily, i don’t know why you did it like this, having one local script would make it 100% easier if you needed to link some sort of communication, i have ALOT of guis, folders, and i create only one single local script to handle all buttons, frames and guis… still, i don’t know better methods than a single local script handling all stuff

Detecting the imagebutton being pressed was another issue I had, running the simple code in my LocalHandler script

Teamsui.Frame.ImageButton.Activated:Connect(function()
	print("Pressed!")
end)

Just doesn’t work, I found the only working way to detect the button press on a local script is to have it under the image button, I could be wrong.

Is the Active property of your ImageButton set to true?

Yes


image

As I said, using the configuration I have right now, the Sending script can tell when the image button is pressed just fine.