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

Pop-up GUI with chat command | How to get this to work?

Hello, I am working on a little admin GUI an I cant seem to make my command that makes the GUI pop up to work properly, My GUI is located in a screengui called CmdGUI, under is CmdFrame, under that are 2 GUIs name Page1 & Page 2. I am trying to make a command open page 1 when you say p!cmds however my current script doesnt work. Can you help me make a new script that should function properly? Here us my current script;

`local Command = "p!cmds"

game.Players.LocalPlayer.Chatted:Connect(function(message) if string.match(Command, message) then game.Players.LocalPlayer.PlayerGui["CmdGUI"].Enabled = true else return end

end)`

2 comments

0

edit: ik i should have the screen gui there, im just being dumb lol

0

another edit, the command is setup in a local script in my StarterGUI folder

4 answers

✓ Accepted answer

OOohh i see, Enabled is not a valid member of the frame. This is what Visible is for!

game.Players.LocalPlayer.PlayerGui["CmdGUI"].Visible = true

Also if you do not need that else return thing then you can remove it, it is not necessary edit: no i'm dumb it's not frame but screenGui, try checking the output and look for errors, are there any?

Problem: Thanks for helping solving the problem and collaborating, the issue is that all of the frames in the CmdGUI have property Visible set to false, this means that they are not visible so when you set the GUI enabled, they are still not visible. To fix this set all of the frames Visible property to true, they won't be visible until you set the GUI to Enabled. Also tip: your frames have size property changed by Offset, this causes problem as for example on Iphone 4 the frames will be completely in wrong position, set the size to Scale.

14 comments

0

At this point it may just be me not thinking this through thoroughly, hence me be new to roblox scripting, it still doesnt work :/ Here is an image that may show something that may help solve my issue. Thank you for being interested in helping me out! https://imgur.com/a/O2DXbuP

0

What errors does it give? Do you know what is output? You should learn about it if you don't, it is very usefull for debugging

0

02:44:48.340 - Visible is not a valid member of ScreenGui "Players.PFCDASH_V3.PlayerGui.CmdGUI"

0

Right yeah it must be ScreenGui.Enabled sorry for that i thought it's a Frame, try checking for errors now with ScreenGui.Enabled

0

https://imgur.com/a/V580K6t still doesnt seem to work :/

0

Is the first image you sent the whole script? These 2 errors have nothing to do with the script you showed before, only the error at the bottom is in the script you showed but i there is not line in the picture you showed that would be causing it

0

the first image i sent is the script there to open it. I know, those 2 errors arent even actual errors its because i messed with my radio GUI on accident (This already functions properly). and i know, thats what i mean, idk what wrong with my script lol

0

The script you showed when asking question has no reason to not work, it could be something in your game, you could try creating blank place and doing the same script just to test it.

0

alr

0

Did a test run, still cant get it to work, i uploaded the baseplate with just the GUI to here; https://anonfiles.com/58J2V7hfpe/Baseplate_rbxl , tell me if you see anything wrong :/

0

I found an answer, i will edit my post

0

i do beleive this would be the case, but how do i make it to where I cant see the gui as joining the game, i set them both to visible, but I see them when I load in now, any other fixxes for this. Im sorry to be such a pain, just dont understand LUA to well yet.

0

You must set the GUI Enabled to false first in the Studio. When you then type in the command, set Enabled to true and it will be visible.

0

Thank You!

You cannot use "Enabled" for a frame, that's only for The ScreenGui itself. You need to use Visible.

Your solution:

game.Players.LocalPlayer.PlayerGui["CmdGUI"].Visible = true

Edit: You added something on the first line that might've broke the script. `, is what you added on the first line, be sure to take that away!

2 comments

0

https://imgur.com/a/O2DXbuP thats my current setup

0

https://imgur.com/a/O2DXbuP thats my current setup - I got this error trying what you said 02:44:48.340 - Visible is not a valid member of ScreenGui "Players.PFCDASH_V3.PlayerGui.CmdGUI" -

Not sure if this is what you was asking but i've compiled what you had into one local script in your CmdGUI Gui

How to use:

Delete every other local script inside your gui (assuming this is all what you have so far!.. otherwise DON'T) Apart from your main local Script obviously OR create a new one. So its the only script inside/controlling your gui

Move your main local script that was in game.players.LocalPlayer.StarterGui and move it into your CmdGUI.

If all went well you can summon the gui and turn the page of your gui from 1 to page 2.

Structure:

--[[
StarterGui
CmdGUI
\------ LocalScript
\------ CmdFrame          <<-- Make sure this is set to Visible!
\------\------ Page1
\------\------\------ Close
\------\------\------\------ UICorner
\------\------\------ Next
\------\------\------\------ UICorner
\------\------ Page2
\------\------\------ Back
\------\------\------\------ UICorner
\------\------\------ Close
\------\------\------\------ UICorner
etc....
]]

Main Local Script:

-- Written By PFCDASH_V3 - Peyton Le Head Developer --

local Command = "p!cmds" 
local Gui = script.Parent
local Page1 = Gui.CmdFrame.Page1
local Page1_Nextbtn = Page1.Next
local Page1_Closebtn = Page1.Close
local Page2 = Gui.CmdFrame.Page2
local Page2_Prevbtn = Page2.Back
local Page2_Closebtn = Page2.Close


Page1_Nextbtn.MouseButton1Click:Connect(function()
	Page1.Visible = false
	Page2.Visible = true
end)

Page1_Closebtn.MouseButton1Click:Connect(function()
	Page1.Visible = false
end)

Page2_Prevbtn.MouseButton1Click:Connect(function() 
	Page2.Visible = false
	Page1.Visible = true
end)

Page2_Closebtn.MouseButton1Click:Connect(function() 
	Page2.Visible = false
end)


game.Players.LocalPlayer.Chatted:Connect(function(message)
	-- print(message,string.match(message,Command)) -- uncomment this for debugging!
	
	if string.match(message,Command) then
		script.Parent.CmdFrame.Page1.Visible = true
	else return end

end)

Hope this helps! :)

I'd like to let you know that your system is genuinely terrible, I mean, it's gonna become a whole bunch of elseifs... anyways... you should be using a server script to make this with remote events. And don't use string.match, use string.split or even string.sub if string.split is not needed. Do not use .Enabled, just simply use .Visible, it's easier.

1 comment

0

thought that may be the case this is the only method that I can understand where I am at right now... barely. Thank you for the suggestion though, I may do some research.

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