I’m trying to make a button to open my shop. For some odd reason, it won’t even detect when clicked. Help.
script.Parent.OpenShop.MouseButton1Click:Connect(function()
print("1")
script.Parent.Parent.Shop.Frame.Visible = true
end)
--Mobile Open
script.Parent.Close.TouchTap:Connect(function()
print("2")
script.Parent.Parent.Shop.Frame.Visible = true
end)```
Note: I am using a mouse to use the button. Nothing printed on the client or server-side.
The button itself should have the highest zindex. So for example if your button zindex is 1 and the background is 2 you can’t click the button because the top layer is blocking the bottom layer. But if you made the zindex of the button 3 you would click on the button because the button layer is higher than the background layer.
@slothfulGuydevfourm.rbxl (26.8 KB) @adminaccount58
The shop UI is on my screen. Also the zindex was already higher than everything. (I tried with 3 just in case)
Okay, then you need to remove the second part of the script that references Close then… This error also shows up in the Output so check that before posting on the forum for quick solutions.
@adminaccount58 It is an open button. May make it a close button in the future but right now I need to open the shop. @BanTech The second part of the script is for mobile. I changed it just in case and I still got no output.
Please use three backticks ``` to format code on the forum, not a quote block as it doesn’t preserve the indentation or code highlighting.
And your updated code works correctly, as you are now referencing a button that exists. Feel free to mark the correct answer with the solution checkmark.
Yes it does. I pasted the code you just put in your last reply and it works fine.
Be sure to click Play Solo button or publish and play your game to get the latest changes.
Edit: More info to try to explain.
The original problem is as I described in my first reply - you referenced Close instead of OpenShop, and Close didn’t exist in that Gui.
Your current problem is that you haven’t published or are testing an old version in studio with the original code, not the new code you just wrote. Stop any testing and then click Play again.
Honestly, I’m getting very confused with this code (I’m guessing you are too).
I tried it again, tried it in the actual Roblox game and it won’t work. I’m going to see if there is part of the drag-and-drop scripts that is causing this. Videos: robloxapp-20200429-1157257.wmv robloxapp-20200429-1201254.wmv
I don’t think I am confused with the code. It’s very simple and your code works.
Here is the place file you uploaded, with your code pasted into it directly from the DevForum. I haven’t changed anything else. Open this place and click the Play Solo button ( ), or publish and play the game.