in these images, one shows the fact that im trying to make it where when a new prompt gets created it destroys the old one immediately (to prevent stacking.), but i keep getting this error in the other image, and i have no idea how to get around this since im handling the gui in a modulescript.
#i require assistance please
1 messages · Page 1 of 1 (latest)
Just check if gui exists by checking if it is nil or if the parent of the gui is nil
I know it doesnt solve the issue much but you can replace lines 16-18 with pps.PromptHidden:Connect(custompromptmodule.onhidden)
if not gui or not gui.Parent then return end
ive added it
and when i walk away it puts "test" aswell (i removed it before sending that img)
what
if not gui or not gui.Parent then return end
I mean here
no
oh
i'll explain
ok
This is your error. It means that its trying to call the Destroy method on a variable which does not have that method.
yes
The reason for why it does not have that method is probably because the gui doesn't exist anymore because it already got destroyed
oh yeah
to be fair
when i loaded in
and i looked in player gui, i noticed one immediately get removed
but then a new one got added
right afterwards
strange but you can avoid the error by just checking if the gui exists
which you do by checking if the gui == nil or the parent of the gui == nil. And the simplified version of that would be:
if not gui or not gui.Parent then return end
its the same as:
if gui == nil or gui.Parent == nil then return end
yeah i know
but im confused, if it prints test if the gui doesnt exist, then what else is there to do?
thats me going away from it
my main point is that i want to make it stop stacking
like all the guis
can i see where you create the gui
do your npcs all have different names?
nonono
i have it where if the proximity prompt has like itemdetailprompt for the attribut ethen it creates the ui for it
ah its not about npcs anymore
no
im now working on proximity prompts
then ill get to dialog prompts
or later on maybe
ive been working on this 4 ages but i barely work on it
like here and there
so this function triggers when?
aaa
yes
function module.onhidden(instance, prompt, InputType, gui)
if currentprompt then
if gui and gui.Parent then
gui:Destroy()
currentPrompt = nil
end
end
end
Should do it tho.
also this doesnt work btw
I just noticed that your giving your onhidden function only nil values
i just realised that aswell..
should i try make it where if theres another gui duplicated it removes the old one in createpromptforattribute?
well i think the best thing to do is just to not even create a new gui if there already is one.
Feels alot cleaner
how do i do that
i think using values can do but i dont want to do that,i feel like theres a simpler way
can i see your function that creates the itemdetailprompt
.
Make a function to detect if a itemdetailprompt already exists that has its adornee set to the prompts parent.
Just loop through each itemdetailprompt and check if the adornee is the same as the parent of the prompt variable given inside the function.
huh its just a for loop and returning true if the condition is met
no but like ive been trying for hours now
its lowkey draining me
nothing works
ill do this later
i give up with this shit
atm
fair enough. Breaks are needed
Ping me once if you got it to working or if there is another issue.
where should i put this now
in the createprompt function?
omg
nevermind
i got it to work
all i had to add was only gui in the function
wait nvm
the thing is, when i put gui it showed ProximityPrompt instead of BillBoard gui
which i suppose thats what i want it to say
no it doesnt
** You are now Level 10! **