GUI Events on surfacegui don't fire

so, I just made a donation sign. I’m trying to make that once the local player interacts with it, some tweens play and when they click the gamepass is prompted.

I currently have a local script inside every “blank” frame, and the surface gui is originally in server storage, then when a player equips the donation sign the surfagui is cloned from the server storage by the server and put inside every player’s PlayerGui.

serverscript:

local donateBoardEvent = ReplicatedStorage.DonateBoard
local signBoardGUI = ServerStorage.SignBoard
local tool = script.Parent

donateBoardEvent.Event:Connect(function(owner, gamepasses)
	local player = tool.Parent.Parent
	
	if owner ~= player then return end
	
	-- get a new surfaceGUI
	for _, player in ipairs(Players:GetPlayers()) do
		local newSurfaceGUI = signBoardGUI:Clone()
		newSurfaceGUI.Parent = player.PlayerGui
		newSurfaceGUI.Adornee = tool:FindFirstChild("Board")
    end
end)

localscript

local Players = game:GetService("Players")

local btn = script.Parent
local frame = script.Parent.Parent

frame.MouseEnter:Connect(function()
	print("entered")
end)

btn.MouseButton1Click:Connect(function()
	print("clicked")
end)

however, no “entered” is printed when the local player hovers over it. how can I fix this?

btw the surfacegui has the Adornee set as the sign board into the workspace

you’d have to use a server script i believe, like this:


if i do the exact same script with a local script however, it doesn’t print; if you want to write logic, you’d have to fire a remote event

1 Like

alt, will try this. charrrrrrr

1 Like

awesome; if you want to get the player object for firing the event, you can just do:

local mockPlayer = script.Parent.Parent.Parent.Parent.Name
local FoundPlayer : Player = game:GetService("Players")[mockPlayer]
print(FoundPlayer.Name)

(change the amount of parents accordingly)

btw, the surfacegui is into playergui. are you sure I gotta add a script there?

thats what i did!!! (i set the adornee to the part)

1 Like

still no prints!!! this is a really strange bug isnt it?

this is a place file of the demo i made, you can compare it:
demoooo.rbxl (57.7 KB)
are you sure urs is setup like this?
image

nope! i didnt put the surfacegui into startergui initially, but first in server storage and every time a new player joins into the server its replicated into every player

> PlayerGui

try put it in startergui and tell me the results

simply disable the localscript in serverstorage and enable it via serverscript once the surfacegui is cloned into the players playergui

so like this

local donateBoardEvent = ReplicatedStorage.DonateBoard
local signBoardGUI = ServerStorage.SignBoard
local tool = script.Parent

donateBoardEvent.Event:Connect(function(owner, gamepasses)
	local player = tool.Parent.Parent
	
	if owner ~= player then return end
	
	-- get a new surfaceGUI
	for _, player in ipairs(Players:GetPlayers()) do
		local newSurfaceGUI = signBoardGUI:Clone()
		newSurfaceGUI.Parent = player.PlayerGui
		newSurfaceGUI.Adornee = tool:FindFirstChild("Board")

        newSurfaceGUI.LocalScript.Enabled = true -- enabling the script inside the gui

    end
end)
2 Likes

nope, still doesn’t. work!!! charr rahhhh

that’s… really weird… can you please try a different surfacegui to make sure it isnt an issue with the one ur using?

gonna first try putting the surfacegui directly into startergui

1 Like

alright lmk the results :doh: charrrrrr

tried the startergui method. doesn’t work either rip

try this !!! you can also use the demo place i provided

is it only the .MouseEnter which is not working or the .MouseButton1Click too?

i don’t see how the surfacegui could be having problems, saw ur place but didn’t help unfortunately