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
4 years ago
Edited 4 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

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

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 — 4y
0
if not maybe cloning isn't working correctly or just put the gui in startergui TradingForDom 1 — 4y
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 — 4y
0
I tried both of your helps and it actually worked im very happy thank you alot! kepiblop 124 — 4y

1 answer

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

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

01local button = script.Parent --Declare button
02local ui = script.Parent --Delcare UI/Frame
03local debounce = false
04 
05button.MouseButton1Click:Connect(function()
06    if debounce == false then
07        debounce = true
08        ui.Enabled = true -- or if it is a frame ui.Visible = true
09    else if debounce == true then
10        debounce = false
11        ui.Enabled = false -- or if it is a frame ui.Visible = false
12    end
13end)

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 — 4y
0
Oh CRAZYQUACKY84 113 — 4y
0
Make sure u edit the thread saying u fixed it CRAZYQUACKY84 113 — 4y
0
Okay kepiblop 124 — 4y
Ad

Answer this question