Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

VERY Simple GUI Script Won't Work and No Output[?]

This simple script:

script.Parent.Close.MouseButton1Click:Connect(function()
	script.Parent.Parent.Enabled = false
end)

That used to close script won't work, no output.

Type: LocalScript

1 comment

0

Enabled just means you're able to interact with the GUI. It does not close the GUI, but it disables user interaction with the GUI. What you're looking for is this property as well as the Visible property.

2 answers

✓ Accepted answer

You need to use PlayerGui, it is because player (client) only sees his own playergui, which is client. But server sees the StarterGui. This is also a new update, so teach other people who doesn't know!

script.Parent.Close.MouseButton1Click:Connect(function()
	game.Players.LocalPlayer:WaitForChild("PlayerGui").ScreenGui.Frame.Enabled = false
end)

2 comments

0

Also, locate the thing you want to disable in line 2, it was a guess

0

btw i just change it to server script and works :P, here free rep

DeceptiveCaster on the comments explained why it doesn't work. Disabling it only means you can't interact with it. Instead do this:

  1. Parent the the stuff in the screen gui to a Frame that is whole screen wide and BackgroundTransparency 1 so it is invisible.

  2. edit the local script to this:

script.Parent.Close.MouseButton1Click:Connect(function()
	script.Parent.Parent.Visible = false
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.