Help needed with Ui Scripting

Hi everyone,

I am encountering an issue with my script from a text button and would appreciate any help or guidance you can provide.

I am working on a shop for my game. When a desired in game part is touched, the Shop Ui pops right after (that mechanism works), but the shop has 3 other frames associated with 3 side buttons that should open each of the frame (as shown below).

Example: when button 1 is clicked, it should reveal a frame positioned in the middle of the screen (here is the Gamepass Shop Frame) and this should happen for button 2 and button 3 as well, but with a designated frame for each button. The main problem is that the buttons (1, 2 and 3) cannot be clicked and the frames cannot be revealed. I have tried different methods but none seem to work.

Here is one script I’ve tried before:

local textButton = script.Parent
local gamepassesFrame = textButton.Parent:FindFirstChild(“GamepassesFrame”) – this is how the main frame is named, the one that should appear when button is clicked
local function toggleGamepassesFrameVisibility()
if gamepassesFrame then
gamepassesFrame.Visible = not gamepassesFrame.Visible
else
warn(“GamepassesFrame not found”)
end
end
textButton.MouseButton1Click:Connect(toggleGamepassesFrameVisibility

Thank you in advance for your help. Any insights or suggestions will be greatly appreciated as I’m trying to solve this problem as soon as possible!

Hello there! While you seem to be going in the right direction, let’s work together to find a solution! 1. Button Clickability: Make sure that there are not the any other UI element is interfering for the TextButton components. You can verify their ZIndex attributes to confirm they are at the top. 2. Frame Pointers: Re-check for the Frame Names. Check to Make Sure They Exactly Match What’s In Your Script Errors of any size can arise. 3. Editing the Script: It seems you have a slight problem easily fixed in your code. This is the correct line to be on for the TextButton Now click 4 MouseButton1Click:Connect: ToggleGamepassesFrameVisibility; Debugging - print statements to indicate, ensure that your function is being called; For example: local function Toggle Gamepasses Frame Visibility () print ( “Button clicked” if gamepasses Frame then gamepasses Frame. GamepassesFrame.visible =false Observable elsewhere.

6 Likes