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?
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
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)