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

GUI not turning transparent and ignoring the script?

3 answers

✓ Accepted answer

you dont change the startergui, you change the player gui so in order to do this you do the following code

local open = 1

script.Parent.MouseButton1Click:Connect(function()
    if open == 1 then
        game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = false
        game.Players.LocalPlayer.PlayerGui.ScreenGui.TextButton1.Visible = false
    end
end)

startergui is the gui that gets replicated to every player but its the player gui all the players see and its local to them so nobody will see the change except for the player that clicks it

5 comments

0

It may have a infinite yeild waiting for the button, or the frame without wait for child

0

Nor will this work if not a local script as you cannot access the player gui without localplayer or using a parameter inside your script

0

It'll work just fine in a LocalScript. Give it a break.

0

it is a local script

0

Thank you!

Hi! I can tell you may be getting upset about this, but there is a reason the script is incorrect. The reason your script is failing to turn the GUI transparent is because you are not taking into the use of Local and accessing the LocalPlayer and the players PlayerGui To do this, first set our script as a LocalScript Inside StarterGui. What we want to do first ; set up our variables. First, let us set up the player.

local player = game.Players.LocalPlayer -- we can access the LocalPlayer because we have a LocalScript.
local open = 1

Now, let us set the visibility to false in our function, you had this correct.

script.Parent.MouseButton1Click:Connect(function()
    if open == 1 then

    end
end)

Now, In order to access the Player'sGui We do exactly this ;


local player = game.Players.LocalPlayer

player.PlayerGui -- How we access the players GUI

Now, let us put the script together

local open = 1


script.Parent.MouseButton1Click:Connect(function()
    if open == 1 then
    local frame = player.PlayerGui:WaitForChild("ScreenGui"):WaitForChild("Frame")-- what frame we are looking for, and wait for  that frame, and then lets change the visibility
frame.Visible = false
-- and same for the next
        local button = player.PlayerGui:WaitForChild:("ScreenGui"):WaitForChild("TextButton1")
button.Visible = false
    end
end)

And there we go!

1 comment

1

I have to downvote you on principle. I'm sorry. The other answer on this question solves the question sufficiently enough that it did not deserve your downvote, and you're mixing server/client business in your script and rationale

if you want to change things in the starterGUI…

-- don't do this:
game.StarterGui.ScreenGui..Frame.Backroundtransparecy = 1
-- do THIS (btw the script has 2 be in frame)
script.Parent.Backroundtrancparecy = 1
--hope this helps!

2 comments

0

you dont change the startergui, you change the player gui

0

the fourth line works. its in pretty much all of me games m8

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