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

When i click textbutton the GUI won't show up. What should i do?

Asked by 6 years ago

I have been looking for a way to my my about pop up. Since I have no idea how to use tweenposition I though about working on the classic .transparency but when i tried this, it deosn't seem to want to work. Script 1:

function OnClick()
    if script.Parent.Parent.About.BackgroundTransparency == 1 then
        script.Parent.Parent.About.BackgroundTransparency = 0
        script.Parent.Parent.About.Close.TextTransparency = 0
        script.Parent.Parent.About.Close.BackgroundTransparency = 0
        script.Parent.Parent.About.Text.TextTransparency = 0
    else --If Its already open then just close it
        script.Parent.Parent.About.BackgroundTransparency = 1
        script.Parent.Parent.About.Close.BackgroundTransparency = 1
        script.Parent.Parent.About.Close.TextTransparency = 1
        script.Parent.Parent.About.Text.TextTransparency = 1
    end
end

script.Parent.Parent.Clicky.MouseButton1Down:connect(OnClick)

Script 2:

function OnClick()
    script.Parent.Parent.Parent.About.Close.BackgroundTransparency = 1
    script.Parent.Parent.Parent.About.Close.TextTransparency = 1
    script.Parent.Parent.Parent.About.Text.TextTransparency = 1
end


script.Parent.Parent.Close.MouseButton1Down:connect(OnClick)

This is the layout. https://i.imgur.com/YLBMExE.png

On screen while Open https://i.imgur.com/Ud0FSQq.png

While Closed https://i.imgur.com/N4mutAF.png

I am open to ANY tips for scripting. I am also trying to to lag the game too much and the game is FE.

1 answer

Log in to vote
0
Answered by 6 years ago

If you are that the script you placed it on is a TextButton, then you can try using a remote event. Put this into the close button.

Make sure to insert a remote event inside that textbutton, then proceed below.

LocalScript [Inside TextButton]

script.Parent.MouseButton1Click:Connect(function()
    script.Parent:WaitForChild('RemoteEvent'):FireServer()
end)    

Script [Inside textbutton]

script.Parent:WaitForChild('RemoteEvent').OnServerEvent:Connect(function()
    script.Parent.Parent.Visible = false
end

For the clicky script [On script 1 that you posted]

Make sure to insert a remoteevent inside that textbutton, then proceed below.

Localscript [Inside TextButton]

script.Parent.MouseButton1Click:Connect(function()
    script.Parent:WaitForChild('RemoteEvent'):FireServer()
end)

Script [Inside TextButton]

script.Parent:WaitForChild('RemoteEvent').OnServerEvent:Connect(function()
    if script.Parent.Parent.About.BackgroundTransparency == 1 then
        script.Parent.Parent.About.BackgroundTransparency = 0
            script.Parent.Parent.About.Close.TextTransparency = 0
            script.Parent.Parent.About.Close.BackgroundTransparency = 0
            script.Parent.Parent.About.Text.TextTransparency = 0
    else
        script.Parent.Parent.About.BackgroundTransparency = 1
            script.Parent.Parent.About.Close.TextTransparency = 1
            script.Parent.Parent.About.Close.BackgroundTransparency = 1
            script.Parent.Parent.About.Text.TextTransparency = 1
    end
end)

0
I tried what you said and it didn't seem to work. I though that GUI's use only local script unless they need to go past StarterGUI. Sergiomontani10 236 — 6y
Ad

Answer this question