MouseButton1Click Issue

  1. This current section of the script is to close it when the Mouse button hits no.

  2. image

image

As you can see the first picture is the script and the second is the output. According to the second image line, 7 has an issue. However, I don’t know how to fix it.

image

1 Like

You’re trying to edit the StarterGui, but you should be trying to edit the PlayerGui!
When the player spawns, all the UI content in StarterGui gets placed into the player’s PlayerGui.

Change the variable so they are in PlayerGui instead, such as:

local no = Player.PlayerGui.OfficePromtGui.Frame.NoButton
1 Like

Hi. Sadly this fix hasn’t sorted the error. However, I would like to thank you for trying to help me. (:slight_smile:

Question, are you sure this is the script that error is popping off from?

Yep. This is the only script in my game. The “No” option on my GUI also doesn’t work.

Can you show us the StarterGui part of your game Explorer? It would be easier to tell what’s wrong with your script that way.

image

Reading the name of the script, I’m pretty sure this is not the script with the problem here.
According to error, it is originated from a script named “EmptyScriptAdder”.

In addition to this, you also shouldn’t be changing the StarterGui, as it only replicates on Player join and respawn if it have ResetOnSpawn checked

Try to use this:

local yes = script.Parent.Frame.YesButton
local no = script.Parent.Frame.NoButton
local gui = script.Parent

no.MouseButton1Click:Connect(function()
    gui.Enabled = false
end)

That will change nothing because this is not the script with the line 7 problem here.

Indeed, but it can solve this problem here.

Try to search for the script which caused the error named “EmptyScriptAdder” in the explorer, and see if it brings up a script.

I can’t answer for him, but I think his script is not the “OfficePromtGui” one, as he’s trying to find it through game.StarterGui instead of script.Parent.

As my first post said, he probably also changed the position from game.StarterGui to Player.PlayerGui

Also, please don’t post images of your codes, that will make spotting issues harder! Instead, you can just insert them here, like this:

print("Hey there! You can do that with the format: ```code```")
1 Like

Your edits worked. Thank you so much. (:slight_smile: