#problems with scripting
1 messages · Page 1 of 1 (latest)
Are there any errors or is the screen gui not disabling?
Close is not a valid member of ImageLabel "Players.Jamal73938.PlayerGui.Settings.Frame .ImageLabel"
Close is not a valid member of ImageLabel "Players.Jamal73938.PlayerGui.Settings.Frame .ImageLabel"
it says it cant find the Pop up and the OffButton
Additionally I would be careful with your naming, you have two objects in the explorer called "Pop up", which can cause a lot of unintented problems
but that might not be related to your problem let me see
yeah ive been getting alot of little problems and its hard to fix
is this the right error message? Looks like its coming from a different script
wait lemme see
if you click on the error in the console it should take you to the script its coming from
it only says this when i remove the script
Close is not a valid member of ImageLabel "Players.Jamal73938.PlayerGui.Settings.Frame .ImageLabel"
ow yeah i know its just a script but its not rlly a problem hold on
it makes the setting tab come up ur right thats not the problem but
i want to make a setting to turn off pop ups
it does say it cant find the Pop up and the OffButton
Then it could be the name, I would recommend finding a different name for one of the duplicate "Pop up" screen guis you have in your game, it could be that the script is using the one that you arent expecting
alright ill change it
then update the reference in the script if needed
Thats an interesting name but we will worry about it in a sec lol
any errors?
wait you named them both pp up
they need to have different names
are you trying to disable them both or just one?
because there is a different way to do so
Try putting each pop up gui in a folder instead
then we can loop through that folder and disable each gui inside
I can teach how if needed
Infinite yield possible on 'Players.Jamal73938.PlayerGui:WaitForChild("Pop up")'
alr
yeah you will have to chnage every reference related to your pop ups to account for the folder
but name the folder something like "Pop ups", the name of the guis doesnt matter anymore they can be the same
yes
then you disable them, you will make a variable that will hold a table (list) of every object in that folder, ex:
-- remove the space on your popups folder
local popUps = playerGui.PopUps:GetChildren()
then you can loop through each object in this folder and disable them individually
for _, popUp in pairs(popUps) do
popUp.Enabled = false
end
ill try but im not that good at scripting im trying to learn it tho i know what a function is
ill try to loop it
alrr
** You are now Level 4! **
The getChildren function looks at an object in the exploerer and puts every child inside of it into a table. for example, lets say I have a screenGui with 4 frames inside of it, name frame1, frame2, ... etc.
When I use :GetChildren() on the screen gui, it will return this
{frame1, frame2, frame3, frame4} and save it as a variable
okay okay i think i get it
then the loop will loop through each item in the list one by one, and will set the popUp variable we made to each item in the list, so when we disable the guis for example, we are going through each gui one by one in the table we made, and running code on it
alr
im trying to get better teaching stuff like this
This will also disable the settings gui because its in the popups folder
if thats not what you want then i would just move the settings screen gui outside of it
woah was not expecting that, sick
but yea like u sayed the settings go away to ill try to fix
and it only goes away after like 1à sec not if i click on the button :('
almost
fixed the cooldown
so is it working or is there something else that needs working on?
i only want it to go away when i click on the On/off Button
i can put a cooldown for when putting it off but i cant get it like to click and then it disables
then move the script we made inside of an event that only fires when the on/off button activates
an event is like your .MouseButton1Click you had on your button before
oh yeaahh
.Activated basically does the same thing but is more universal, invludes mobile device taps and im pretty sure xbox inputs aswell
but im not sure
alr alr thats good
so you will do
on/offButton.Activated:Connect(function()
local popUps = playerGui.popUps:GetChildren()
for _, popUp in pairs(popUps) do
popUp.Enabled = false
end
end
you will have to change each undefined variable you what you have in your game
but thats an example code of what im getting at
lemme show u what i came up with that was sadly not working
k
i added this
if screenGui and offButton and onButton then
offButton.MouseButton1Click:Connect(function()
screenGui.Enabled = false
end)
onButton.MouseButton1Click:Connect(function()
screenGui.Enabled = true
end)
what here isnt working?
lol, put a print statement under each event and see what happens when you try to click the button
oh wait
** You are now Level 10! **
Infinite yield possible on 'Players.Jamal73938.PlayerGui:WaitForChild("Pop up")
it says this
hold up i know why
wait hold up let me fix this first
okay
does "Pop up" exist?
its looking directly in the player gui for something with that name, if it doesnt exist then that that warning will occur
same warning?
let me see your explorer
Change "Pop up" to "PopUps", the name is still different
oh wait
can you copy and paste the exact warning again?
Infinite yield possible on 'Players.Jamal73938.PlayerGui:WaitForChild("Pop up")'
its just this
** You are now Level 5! **
is that in a different script? you have no :WaitForChild("Pop up") here
it could be but i cant seem to find it then
click on the warning and it will send you there
the "not working" one?
yea
I would recommend getting rid of that if and else statement, and move your events outside of it, to see what exactly isnt being defined there
nice
everything still works wheni remove the script so yeah
now when i click it there is no issues but its not working tho
so is this the script that we are looking at or is it the one you deleted
the one i deleted
the picture one is in the folder
and it works but just not with the button
send new screenshot
Ok so let me inplement the code a little better, because we dont need the screenGui.Enabled = false line 16 anymore. So move lines 8-11 inside that event in replacement of it.
Additionally its a interesting thing you learned but I would get rid of your line 13 if statement, it is redundant as it is checking if anything is undefined, but that will be automatically handled from us attempting to define it
bring back your off button event
offButton.MouseButton1Click:Connect(function()
-- lines 8-11 here
end
and remove the end on line 18 and move the lines 14-17 on indentation back
like this right?
yes, do this and move it all back to the far left to get rid of the unneeded space
now i have this
almost, move your onbutton event outside of the offbutton event, those can stay separate
yes, now just move lines 10-13 and 17-18 back one space
has no effect on the code but it helps readability
this?
no like, un-tab it back towards the left
yes do that for 11-14 aswell
like thius
yes
noice
that should be the off button, we will make the on button when we are sure it works
try it
no man 😦
fuckkkkkkkkkkkkkkkkkkkkkkkkk
Infinite yield possible on 'Players.Jamal73938.PlayerGui.PopUps.Pp up:WaitForChild("OffButton")'
honestly if u want to we could do this another time its getting late for prob both of us
if you want, you can dm me when you are back, cause its only 6 pm for me
alr its 00:30 here
oof
but i cant sleep with a loss yk
lol coding will have you at a loss for a couple of days, you'll be fine
whah
alr alr
i think the problem is here thoi
with the buttons and sh
im 90% sure
probably
i think you are looking for the buttons i the wrong spot
it looks like the game needs way more steps to get to the on and off buttons than you have in your script
you should be able to do that then, just update the script to get to the button with the proper steps
