Billboard Gui Button not working

  1. What do you want to achieve?
    Print a text after the Billboard Gui is clicked.

  2. What is the issue?
    Nothing happens, no errors, nothing.

  3. What solutions have you tried so far?
    Well, everything I could think of.

Explorer:
image
image

MGButtonLocal (Local Script)

local MakeGameButtonEvent = game.ReplicatedStorage:WaitForChild("MakeGameButton")
local player = game.Players.LocalPlayer
local playerGui = player.PlayerGui
local billboardGui = playerGui:WaitForChild("BillboardGui")
local btn = billboardGui.TextButton

btn.MouseButton1Up:Connect(function()
	MakeGameButtonEvent:FireServer()

end)

MGButton (Script)

local MakeGameButtonEvent = game.ReplicatedStorage:WaitForChild("MakeGameButton")

MakeGameButtonEvent.OnServerEvent:Connect(function(player)
	print("Button clciked")
end)

Have you tried instead

local btn = billboardGui:WaitForChild("TextButton")

I may be wrong with this but, give it a try.

Nope, sadly it didn’t work. But I’ll keep it like that to be sure. :smiley:

As per convention, it’s better to use :GetService() so maybe change your scripts to use this:

local MakeGameButtonEvent = game:GetService("ReplicatedStorage"):WaitForChild("MakeGameButton")

Okay, I’ll figure out a bit more. Maybe try parenting the localscript to the billboard gui and changing it to this?

local MakeGameButtonEvent = game.ReplicatedStorage:WaitForChild("MakeGameButton")
local billboardGui = script.Parent
local btn = billboardGui.TextButton

btn.MouseButton1Up:Connect(function()
	MakeGameButtonEvent:FireServer()

end)

Thank you fro the tip, will do. But sadly it is still not working.

try debugging your code with print statements, this will allow you to narrow down the problem. For example, put a print statement right after you get the remote event, and then one inside the function connected to the MouseButton1Up event.

Nope, didn’t work. I’ll try the debugging.

do tell us which statements actually print.

The MouseButton1Up one works, the other one doesn’t.

This indicates that the remote event isn’t firing and as such, the server doesn’t know that the GUI was pressed. Just to confirm, the print you put inside the connected function on the local script works, but the print statement in the server script doesn’t right?

1 Like

Yes, exactly. I am not sure why isn’t it firing?

Yeah I have no idea either lol. Before you fire server on the client, can you print the MakeGameButtonEvent object?

Yes, I can.

(Ignore this, the minimum characters is annoying)

Looks like it’s an unsolvable problem? :frowning:

Try using MouseButton1Click and put a print in this too. And make sure you have set the Adornee.

Also delete the old event create a new one with different name.

I have done both, but I have actually figured out the issue. The local script was on the wrong place, once I put it under StarterGui it started working.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.