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

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

Asked by 7 years ago

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

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago
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.

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. TheeDeathCaster 2368 — 7y
0
I guess, alright. But again, that script I made works. I'll just shorten it though. Kraken_54 22 — 7y
Ad

Answer this question