#my ui cant open can someone help?

1 messages · Page 1 of 1 (latest)

late cloak
#

local b = game.StarterGui:WaitForChild("CoreGUI")
local a = b:WaitForChild("SpecsButton")
local player = game.Players.LocalPlayer
ownedunit = Instance.new("Folder", player)
ownedunit.Name = "OwnedSpecs"

function Closeframes()
for i,v in pairs(a.Parent:GetChildren()) do
for i2,v2 in pairs(v:GetChildren()) do
if v2:IsA("ScreenGui") then
v2.Enabled = false
end
end
task.wait(0.5)
end
task.wait(0.5)
end

a.MouseButton1Click:Connect(function()
a.SpecsGUI.Enabled = not a.SpecsGUI.Enabled

for i,v in pairs(player.OwnedSpecs:GetChildren()) do
    local SpecTextButton = Instance.new("TextButton", a.SpecsGUI.MainSpecFrames.OwnedSpecs)
    SpecTextButton.Name = v.Name.."TextButton"
    SpecTextButton.Text = v.Name
    SpecTextButton.BackgroundColor3 = Color3.new(0.0509804, 0.74902, 0.854902)
    SpecTextButton.RichText = true
    SpecTextButton.FontFace.Bold = true
    SpecTextButton.TextScaled = true
end
task.wait(0.5)

end)
a.SpecsGUI.MainSpecFrames.CloseButton.MouseButton1Click:Connect(function()
a.SpecsGUI.Enabled = false
end)

naive yacht
late cloak
#

it means that whatever value it currently is

#

will return the opposite

naive yacht
#

Uh, no

late cloak
#

so if its false, it will b true, n if its true, it will returnrr false

naive yacht
#

No thats not how you use not

late cloak
#

whatt

naive yacht
#

Yeah

#

Its nit english

late cloak
#

if a.SpecsGUI.Enabled == false then
a.SpecsGUI.Enabled = true
elseif a.SpecsGUI.Enabled == true then
a.SpecsGUI.Enabled = false

#

i changed it t o this

#

it still doesnt work

wind mauve
# naive yacht No thats not how you use not

I think that's perfectly fine, using flag = !flag is a perfectly valid way to toggle things in other languages, in lua's case being flag = not flag which may not be good english but it's fine programming

naive yacht
#

Cause t sounds like a sentence

#

Wtv

#

Mb

late cloak
#

what

naive yacht
late cloak
#

no

naive yacht
#

Output

late cloak
#

it dont output errors

#

but it doesnt work

naive yacht
#
local b = game.StarterGui:WaitForChild("CoreGUI")
local a = b:WaitForChild("SpecsButton")
local player = game.Players.LocalPlayer
ownedunit = Instance.new("Folder", player)
ownedunit.Name = "OwnedSpecs"


function Closeframes()
    for i,v in pairs(a.Parent:GetChildren()) do
        for i2,v2 in pairs(v:GetChildren()) do
            if v2:IsA("ScreenGui") then
                v2.Enabled = false
            end
        end
        task.wait(0.5)
    end
    task.wait(0.5)
end



a.MouseButton1Click:Connect(function()
    a.SpecsGUI.Enabled = not a.SpecsGUI.Enabled

    for i,v in pairs(player.OwnedSpecs:GetChildren()) do
        local SpecTextButton = Instance.new("TextButton", a.SpecsGUI.MainSpecFrames.OwnedSpecs)
        SpecTextButton.Name = v.Name.."TextButton"
        SpecTextButton.Text = v.Name
        SpecTextButton.BackgroundColor3 = Color3.new(0.0509804, 0.74902, 0.854902)
        SpecTextButton.RichText = true
        SpecTextButton.FontFace.Bold = true
        SpecTextButton.TextScaled = true
    end
    task.wait(0.5)
    
end)
a.SpecsGUI.MainSpecFrames.CloseButton.MouseButton1Click:Connect(function()
    a.SpecsGUI.Enabled = false
end)
hollow hull
#

you're changing the objects in coregui instead of playergui

west gyroBOT
#

studio** You are now Level 6! **studio

naive yacht
#

Ohhh

#

I see now

late cloak
#

local b = game.StarterGui:WaitForChild("CoreGUI")
local a = b:WaitForChild("SpecsButton")
local player = game.Players.LocalPlayer
ownedunit = Instance.new("Folder", player)
ownedunit.Name = "OwnedSpecs"

function Closeframes()
for i,v in pairs(a.Parent:GetChildren()) do
for i2,v2 in pairs(v:GetChildren()) do
if v2:IsA("ScreenGui") then
v2.Enabled = false
end
end
task.wait(0.5)
end
task.wait(0.5)
end

a.MouseButton1Click:Connect(function()
print("YEsYESYES")
if a.SpecsGUI.Enabled == false then
a.SpecsGUI.Enabled = true
elseif a.SpecsGUI.Enabled == true then
a.SpecsGUI.Enabled = false

for i,v in pairs(player.OwnedSpecs:GetChildren()) do
    local SpecTextButton = Instance.new("TextButton", a.SpecsGUI.MainSpecFrames.OwnedSpecs)
    SpecTextButton.Name = v.Name.."TextButton"
    SpecTextButton.Text = v.Name
    SpecTextButton.BackgroundColor3 = Color3.new(0.0509804, 0.74902, 0.854902)
    SpecTextButton.RichText = true
    SpecTextButton.FontFace.Bold = true
    SpecTextButton.TextScaled = true
end
task.wait(0.5)

end

end)

a.SpecsGUI.MainSpecFrames.CloseButton.MouseButton1Click:Connect(function()
a.SpecsGUI.Enabled = false
end)

wind mauve
west gyroBOT
#

studio** You are now Level 1! **studio

naive yacht
#

local b is the gui in startergui not 0lyaergui

#

Its 2 different things

late cloak
#

oh

wind mauve
late cloak
#

so how do i make it playergui?

naive yacht
#

StarterGUI is a repository of the gui, and it copues the gui in it to playergui

hollow hull
#

get localplayer

late cloak
#

n then

#

wjat 9 d0

hollow hull
#

playergui

late cloak
#

i do*

naive yacht
hollow hull
#

yes

naive yacht
#

And thent hr

#

The

#

Gui

#

Wwitforhcikd

#

Wtv

late cloak
#

it still doesnbt work

hollow hull
late cloak
#

local player = game.Players.LocalPlayer

local b = player.PlayerGui:WaitForChild("CoreGUI")
local a = b:WaitForChild("SpecsButton")

ownedunit = Instance.new("Folder", player)
ownedunit.Name = "OwnedSpecs"

function Closeframes()
for i,v in pairs(a.Parent:GetChildren()) do
for i2,v2 in pairs(v:GetChildren()) do
if v2:IsA("ScreenGui") then
v2.Enabled = false
end
end
end
end

a.MouseButton1Click:Connect(function()
print("YEsYESYES")
a.SpecsGUI.Enabled = true

for i,v in pairs(player.OwnedSpecs:GetChildren()) do
    local SpecTextButton = Instance.new("TextButton", a.SpecsGUI.MainSpecFrames.OwnedSpecs)
    SpecTextButton.Name = v.Name.."TextButton"
    SpecTextButton.Text = v.Name
    SpecTextButton.BackgroundColor3 = Color3.new(0.0509804, 0.74902, 0.854902)
    SpecTextButton.RichText = true
    SpecTextButton.FontFace.Bold = true
    SpecTextButton.TextScaled = true
end

end)

a.SpecsGUI.MainSpecFrames.CloseButton.MouseButton1Click:Connect(function()
a.SpecsGUI.Enabled = false
end)

hollow hull
#
local player = game.Players.LocalPlayer

local b = player.PlayerGui:WaitForChild("CoreGUI")
local a = b:WaitForChild("SpecsButton")

ownedunit = Instance.new("Folder", player)
ownedunit.Name = "OwnedSpecs"


function Closeframes()
    for i,v in pairs(a.Parent:GetChildren()) do
        for i2,v2 in pairs(v:GetChildren()) do
            if v2:IsA("ScreenGui") then
                v2.Enabled = false
            end
        end
    end
end



a.MouseButton1Click:Connect(function()
    print("YEsYESYES")
    a.SpecsGUI.Enabled = true

    for i,v in pairs(player.OwnedSpecs:GetChildren()) do
        local SpecTextButton = Instance.new("TextButton", a.SpecsGUI.MainSpecFrames.OwnedSpecs)
        SpecTextButton.Name = v.Name.."TextButton"
        SpecTextButton.Text = v.Name
        SpecTextButton.BackgroundColor3 = Color3.new(0.0509804, 0.74902, 0.854902)
        SpecTextButton.RichText = true
        SpecTextButton.FontFace.Bold = true
        SpecTextButton.TextScaled = true
    end

end)


a.SpecsGUI.MainSpecFrames.CloseButton.MouseButton1Click:Connect(function()
    a.SpecsGUI.Enabled = false
end)
late cloak
#

idk how to put in the little dark bg

late cloak
#
 local player = game.Players.LocalPlayer

local b = player.PlayerGui:WaitForChild("CoreGUI")
local a = b:WaitForChild("SpecsButton")

ownedunit = Instance.new("Folder", player)
ownedunit.Name = "OwnedSpecs"


function Closeframes()
    for i,v in pairs(a.Parent:GetChildren()) do
        for i2,v2 in pairs(v:GetChildren()) do
            if v2:IsA("ScreenGui") then
                v2.Enabled = false
            end
        end
    end
end



a.MouseButton1Click:Connect(function()
    print("YEsYESYES")
    a.SpecsGUI.Enabled = not a.SpecsGUI.Enabled

    for i,v in pairs(player.OwnedSpecs:GetChildren()) do
        local SpecTextButton = Instance.new("TextButton", a.SpecsGUI.MainSpecFrames.OwnedSpecs)
        SpecTextButton.Name = v.Name.."TextButton"
        SpecTextButton.Text = v.Name
        SpecTextButton.BackgroundColor3 = Color3.new(0.0509804, 0.74902, 0.854902)
        SpecTextButton.RichText = true
        SpecTextButton.FontFace.Bold = true
        SpecTextButton.TextScaled = true
    end
    
end)


a.SpecsGUI.MainSpecFrames.CloseButton.MouseButton1Click:Connect(function()
    a.SpecsGUI.Enabled = false
end) ```
hollow hull
late cloak
#

I DID IT

#

YESSS

#

tymsm

#

ok now how do i fix the code

hollow hull
#

what is Closeframes() function for

late cloak
#

to close out all other frames

#

so like the other uis dont get in the way

hollow hull
#

what exactly isnt working

late cloak
#

the ui when i click on unit button doesnt pop up

#

like the unit inventory

hollow hull
#

Assuming this one?

a.MouseButton1Click:Connect(function()
    a.SpecsGUI.Enabled = true

    for i,v in pairs(player.OwnedSpecs:GetChildren()) do
        local SpecTextButton = Instance.new("TextButton", a.SpecsGUI.MainSpecFrames.OwnedSpecs)
        SpecTextButton.Name = v.Name.."TextButton"
        SpecTextButton.Text = v.Name
        SpecTextButton.BackgroundColor3 = Color3.new(0.0509804, 0.74902, 0.854902)
        SpecTextButton.RichText = true
        SpecTextButton.FontFace.Bold = true
        SpecTextButton.TextScaled = true
    end

end)
late cloak
#

yeps

hollow hull
#

Is there even any objects in the OwnedSpecs folder?

late cloak
#

none

hollow hull
#

that's the reason

late cloak
#

ooo

hollow hull
#

Advice: don't parent instances using Instance.new("Object", ObjectDirectory),
Use this method

local Object = Instance.new("Object")
Object.Parent = Directory
hollow hull
#

dont know jsut some info showed up in devforum before

#

i forgot actually

#

I jsut take people advice easily without knowing the reason

late cloak
#

lmao

#

ill use it too

#

im exactly like u bro

subtle lake
hollow hull
#

testing me eh?

late cloak
#

can u tell me why

#

ok so my code still does not work

subtle lake
# late cloak can u tell me why

it's a microoptimization, instances having a parent also fire property changed events, and since when creating instances is when you're changing lots of properties, parenting it before changing those properties raises events for no reason. Instance.new("Part") part.Parent=workspace part.Color=etc part.CFrame=etc part.Material=etc is the same as Instance.new("Part",workspace) ...etc. the benefit is only in doing Instance.new("Part") ...part.etc=etc... part.Parent=workspace, aka parenting last

#

it also fires replication in some cases like in workspace

late cloak
#

ooo

subtle lake
#

setting parent last sets all the properties at once

late cloak
#

since ure good

#

can u help w my code pls

subtle lake
#

ye you had game.startergui in your original code

late cloak
#
local player = game.Players.LocalPlayer

local b = player.PlayerGui:WaitForChild("CoreGUI")
local a = b:WaitForChild("SpecsButton")

ownedunit = Instance.new("Folder")
ownedunit.Parent = player
ownedunit.Name = "OwnedSpecs"


local function Closeframes()
    for i,v in pairs(a.Parent:GetChildren()) do
        for i2,v2 in pairs(v:GetChildren()) do
            if v2:IsA("ScreenGui") then
                v2.Enabled = false
            end
        end
    end
end



a.MouseButton1Click:Connect(function()
    print("YEsYESYES")
    a.SpecsGUI.Enabled = not a.SpecsGUI.Enabled

    for i,v in pairs(player.OwnedSpecs:GetChildren()) do
        local SpecTextButton = Instance.new("TextButton", a.SpecsGUI.MainSpecFrames.OwnedSpecs)
        SpecTextButton.Name = v.Name.."TextButton"
        SpecTextButton.Text = v.Name
        SpecTextButton.BackgroundColor3 = Color3.new(0.0509804, 0.74902, 0.854902)
        SpecTextButton.RichText = true
        SpecTextButton.FontFace.Bold = true
        SpecTextButton.TextScaled = true
    end
    
end)


a.SpecsGUI.MainSpecFrames.CloseButton.MouseButton1Click:Connect(function()
    a.SpecsGUI.Enabled = false
end)```
subtle lake
late cloak
#

no i mean the `` thing

west gyroBOT
#

studio** You are now Level 2! **studio

hollow hull
late cloak
#

not the actual code

#

yeah lmao

#

i was too dumb

subtle lake
#

oh

hollow hull
#

did you add objects in the OwnedSpecs

subtle lake
late cloak
#

the ui doesnt open when i click the units button

hollow hull
#

First of all, is there even a folder named OwnedSpecs in player?

late cloak
#

yes

subtle lake
late cloak
#

i made an instance.new making it

late cloak
#

when i click

#

it prints the statement

#

but it doesnt pop up the ui

hollow hull
#

think you should change this a.SpecsGUI.Enabled = not a.SpecsGUI.Enabled to a.SpecsGUI.Enabled = true

late cloak
#

i want them

#

so if they click it again

#

itll go false

#

but i tried tht and it didnt work

hollow hull
#

m

subtle lake
hollow hull
#

Does the OwnedSpecs frame have UIobjects that aligns the textbuttons?

subtle lake
# late cloak but it doesnt pop up the ui

a few starting points, make sure a.specsgui is in fact a screengui, exists in the explorer tree (browse to it while studio is in play mode), positioned correctly etc, when you get to it in the explorer and if it's all there, make changes to the properties manually until you get it working once, then just repeat what you need to do in the code

#

also do be sure to turn off resetonspawn

#

since i'm assuming this is a starterplayerscript and your custom coregui should only exist once

#

actually scratch that, i dont think you can turn that off for folders in the root of playergui

late cloak
#

new problem

#

the screengui even when enabled does not appear

#

what could be causes

subtle lake
#

the frames parented to it are invisible, or position wrong

#

or there's no frames hehe

#

cmon, you needed to ask about that? i told you to check the properties of everything

late cloak
#

i fixed the code

#

but now a new error appeared

#

like 5 mins ago it was working

#

works nbow