For some reason, my GUI button is not clicking correctly. Now, the frame this mousebutton is in is having it’s parent changed when the play button is clicked. Also note, the script is inside of the button.
Any fixes?
local playername = script.Parent.Parent.playerusername.Value
local player = game.Players:FindFirstChild(playername)
if player then
print("Found " .. playername)
end
local promptauth = player:FindFirstChild("promptauth")
if promptauth then
print("Found PromptAuth for " .. playername)
else
print("Failed to find PromptAuth for " .. playername)
end
-- This is the part where its bugged
script.Parent.MouseButton1Click:Connect(function()
print("button click")
end)
can you please post a screenshot of the explorer?
if it possible show whole ReplicatedStorage,StarterGui(with screenGuis),parents and childs of the script you are using
May you a post a screenshot ?. However, I can provide some troubleshooting steps you can take:
Make sure the script is attached to the correct GUI button. Double-check that the script is attached to the button you’re trying to click.
Check the output console for any error messages. If there are any errors, they will be displayed in the output console. Fix any errors that are displayed and try clicking the button again.
Check if the script is running at all. Add a print statement at the beginning of the script to see if it’s running at all. If you don’t see the print statement in the output console, then the script may not be running.
Try using InputBegan instead of MouseButton1Click. If the button is not registering clicks, you can try using the InputBegan event instead. This event fires whenever the button is pressed, regardless of whether it was clicked or touched.
Check if the button is enabled. Make sure that the button is not disabled or invisible, as this will prevent it from being clicked.
Check if there are any other scripts that could be interfering. If there are other scripts attached to the button or its parent frames, they could be interfering with the button’s click event.
I personally do not use MouseButton1Click, I use MouseButton1Click or script.Parent.Activated. These work for me all the time. That might be your issue. try using MouseButton1Click or script.Parent.Activated instead