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

trying to make a textbox be removed but doesent seem to remove?... :/

ok so here is my code...

function idk() game.StarterGui.ScreenGui.colorred.visible = false game.StarterGui.ScreenGui.colorpink.visible = false game.StarterGui.ScreenGui.colorcyan.visible = false end script.Parent.MouseButton1Click:connect(idk)

so what im trying to do here is when i click a first button 3 more buttons pop up with colors so people can change them.. but when i click the first button with this code in it it doesent disappear am i doing somthing wrong?

1 answer

local Player = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui") --Getting the local player

function idk() 
Player.ScreenGui.colorred.Visible = false 
Player.ScreenGui.colorpink.Visible = false 
Player.ScreenGui.colorcyan.Visible = false 
end


script.Parent.MouseButton1Click:connect(idk)

Also, make sure that this is in a LocalScript parented to the button that when you click the other buttons with disappear.

(What did you do wrong)

You tried editing the StarterGui (Gui) therefore editing the item when the player respawns.

2 comments

0

Wouldn't it be more efficient to use a variable, rather than rewrite lines 4-6? (To get from Player to the ScreenGui) However, if you wish to keep it the way it is, I suggest removing the yields on 5-6, as the first (line 4) has already waited for the PlrGui.

0

I guess, alright. But again, that script I made works. I'll just shorten it though.

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