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

[FIXED]local script executes and does work but gui doesn't pop up?

Asked by
kepiblop 124
3 years ago
Edited 3 years ago

Hello I am doing a work Local script let me explain. This script will make you press a text button and then a gui pops up. This is what I got so far

wait(6)
game.Workspace.building.kepiblopsworkdesk["kepiblop's computer"].Screen.SurfaceGui.Frame.TextButton.MouseButton1Down:Connect(function() --Button that they click
    local player = game.Players.LocalPlayer
    local gui = game.Workspace.building.kepiblopsworkdesk["kepiblop's computer"].Screen.kepibloppc --Computer gui
    local guiclone = gui:Clone()
    guiclone.Parent = player:WaitForChild('PlayerGui')
    gui.Enabled = true
    if gui.Parent == nil then
        warn("Player hasn't gotten the gui yet")
    else
        print("gui given!")
    end
end)

I am not using variables for long ones because i really wanted to give my fingers a workout It may not look clean so i will put comments on what they are! I know what you're thinking Where's the problem and what is the problem? Well believe it or not it actually works problem is it doesn't pop up and it just stays there Here's what I can confirm

The Local script works

The local script is in ReplicatedFirst

All frames are visible except for the unnecessary ones

The problem is that the gui does not become visible but it does execute and it does go there

Hopefully I got everything important and clear Thanks!

0
Maybe try putting if gui ~= nil then cause that may work TradingForDom 1 — 3y
0
if not maybe cloning isn't working correctly or just put the gui in startergui TradingForDom 1 — 3y
0
I wanted it to warn the player when if it doesnt been given but thanks for fast input i will try it! kepiblop 124 — 3y
0
I tried both of your helps and it actually worked im very happy thank you alot! kepiblop 124 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

Make sure the local script is in StarterGui and then simply follow this script

local button = script.Parent --Declare button
local ui = script.Parent --Delcare UI/Frame
local debounce = false

button.MouseButton1Click:Connect(function()
    if debounce == false then
        debounce = true
        ui.Enabled = true -- or if it is a frame ui.Visible = true
    else if debounce == true then
        debounce = false
        ui.Enabled = false -- or if it is a frame ui.Visible = false
    end
end)

Make sure your UI or Frame .Visible/Enabled is set to false.

I also personally think variables are more easier as it shows where the error is if wrong.

0
Its fixed already but thanks for the input! kepiblop 124 — 3y
0
Oh CRAZYQUACKY84 113 — 3y
0
Make sure u edit the thread saying u fixed it CRAZYQUACKY84 113 — 3y
0
Okay kepiblop 124 — 3y
Ad

Answer this question