Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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!

4 comments

0

Maybe try putting if gui ~= nil then cause that may work

0

if not maybe cloning isn't working correctly or just put the gui in startergui

0

I wanted it to warn the player when if it doesnt been given but thanks for fast input i will try it!

0

I tried both of your helps and it actually worked im very happy thank you alot!

1 answer

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.

4 comments

0

Its fixed already but thanks for the input!

0

Oh

0

Make sure u edit the thread saying u fixed it

0

Okay

This discussion is preserved as it was. New answers, comments, and votes are closed.