Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 3 years ago

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

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. DeceptiveCaster 3761 — 3y

2 answers

Log in to vote
1
Answered by
Xapelize 2658 Moderation Voter Community Moderator
3 years ago

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)
0
Also, locate the thing you want to disable in line 2, it was a guess Xapelize 2658 — 3y
0
btw i just change it to server script and works :P, here free rep The_Saver31 260 — 3y
Ad
Log in to vote
0
Answered by
NGC4637 602 Moderation Voter
3 years ago
Edited 3 years ago

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)

Answer this question