Hey, so I’ve always found the usual remote event communication, although easy to implement, not very scalable, hard to read and sometimes just plain broken if you’re not careful.
For this reason, I’ve been fiddling with new methods to get around that. One of them, is to have the server create and setup the mouse button click functions and what they do. I know Local Scripts are almost a necessity for control the GUI, but it has been working so far and my code has improved greatly, but there’s a weird bug I’m having.
If I try to connect a button’s Activated event through the server… nothing happens. No errors, nothing. But if I connect it to the MouseButton1Click event, that does work.
Mind you both the Activated and the MouseButton1Click event work under a Local Script, so it’s nothing related to ZIndexes or Active properties.
Does anybody know the reason behind this? Is it a bug I should report? Also, isn’t Activated the suggested event to use now instead of MouseButton1Click?
Cheers!
Oh and here’s a sample of the code:
local function setWorldAndCrateTextListenersAndImages(frame: WorldFrame, params: WorldCrateParams)
getWorldLabel(frame).Text = params.worldName
for _, crate in pairs(params.crateParams) do
getCrateFrameImage(frame, crate.position).Image = crate.imageId
getCrateLimitedEdition(frame, crate.position).Visible = crate.isLimitedEdition
getCrateTitle(frame, crate.position).Text = crate.name
getCrateDescription(frame, crate.position).Text = crate.description
getOpenCrateButton(frame, crate.position).Activated:Connect(crate.buyAndOpenFunction) --If I use this method, nothing happens
getOpenCrateButton(frame, crate.position).MouseButton1Click:Connect(crate.buyAndOpenFunction) --If I use this method, the function I send from the server script does indeed run
end
end
module.addWorldFrameToTab = function(params: WorldCrateParams)
local newWorldFrame = modelFrame:Clone()
setWorldBackgroundColor(newWorldFrame, params.worldColor)
setWorldAndCrateTextListenersAndImages(newWorldFrame, params)
newWorldFrame.Parent = tabShop
end