Tool script wont make player GUI frame visible

So I am making this tool for searching other player’s backpack, but for some very weird reason, the local GUI frame on the client just won’t show up, its almost like all the GUI processes in the script just dissappeared.

This is the part of the script which causes me trouble:

local accepted, inv = patdownRequest:InvokeServer(targetPlayer)
	
	
	if accepted == nil or accepted == false then allowPlayerPatdown() return end

	print(patdownMainframe)
	patdownMainframe.Visible = true
	
	for i,v in pairs(inv) do
		local button = patdownItemButton:Clone()
		button.ZIndex = 1
		button.Visible = true
		button.Parent = patdownItemMenu
		
		button.Text = v
		button.MouseButton1Click:Connect(function()
			patdownRemote:FireServer(v)
		end)
	end

	for i = 10,0,-1 do
		patdownTimer.Text = tostring(i)
		
		task.wait(1)
	end

	patdownMainframe.Visible = false

the patdownMainframe just won’t set to visible, even though the print statement above it prints “Frame”, which brings me to another weird thing, being that when I click the printed instance in the output, it won’t highlight me the frame in explorer but shows me the script line instead.

by the way, the buttons in the pairs loop also aren’t created in the list, even though the table returned from the remoteFunction contains several strings, and when I added a print statement in the loop, it printed all the elements in the table, but the buttons just did not show up.

if anyone is interested, this is how I define the gui elements.

local players = game:GetService("Players")
local player:Player = players.LocalPlayer or players.PlayerAdded:Wait()
local playerGUI = player:WaitForChild("PlayerGui")
local patdownGUI = playerGUI:WaitForChild("patdown")
local patdownMainframe = patdownGUI:WaitForChild("Frame")
local patdownItemMenu = patdownMainframe:WaitForChild("ScrollingFrame")
local patdownItemButton = patdownItemMenu:WaitForChild("TextButton")
local patdownTimer = patdownMainframe:WaitForChild("patdownTimer")

and of course, everything is running in a local script.

From all this behaviour, it almost looks like there was like a copy of this whole player GUI somewhere, and all the actions were performed on it, since there are no errors and it acts like its working.

Another interesting thing is that when I did not define the patdown timer on the start, but instead in the for loop used patdownMainframe.patdownTimer, I got an error saying that patdownTimer doesnt exist as a child for the patdownMainframe, which is also extremely weird. I’ve been stuck on this for several days already, and I have completely ran out of ideas. Any help will be appreciated!

well if you think that the gui the script is referencing is somewhere else you could use the GetFullName() method on it to see where it leads to.

otherwise im shooting in the dark, it would be helpful to see a video or 2 on what exactly is going on cause just seeing the code isnt making anything click for me.

okay, I tried printing the full name, and it literally printed only “Frame”, I don’t understand how this even happens, its like the whole gui just got cloned into nothing. So I tried to define all the variables again on tool equip, considering the possibility that the reference somehow bugs out as the tool is initialised while the player is loading, however it did not change a thing, even defining every single variable again when the whole game is loaded and a few seconds before it is used, it again prints only the “frame” instance as a full name. Here is a video you requested, I don’t think it will be helpful though

1 Like

that means that its parented to nil, which makes no sense unless your reparenting it to a object that doesnt exist the moment you get access to the variable

that’s exactly the problem, I do not set parent of any gui object in the whole script other than the buttons which come AFTER the full name printing. It doesn’t make any sense at all

is another script thats destroying the gui? cause if im correct scripts can have references to objects that are reparented or destroyed(? i dont actually know if thats true)

they cannot if the object is detroyed and they can if its just reparented to nil, although it doesn’t really matter at this point since I am absolutely sure there is not other script destroying or reparenting any of theese objects

if it wasnt in the script you gave, i doubt anybody will be able to help any more than what i’ve already done.

try this, just out of curiosity

just as we thought, the frame exists but somewhere in the abyss
image

1 Like

add a new local script inside the frame

script.Parent:GetPropertyChangedSignal('Parent'):Connect(function()
 print(script.Parent.Parent)
end)

so we can see when the parent changes.

also, in the video are you definetly looking inside the playergui for that player in the explorer, and not the startergui?

the event never fired and haven’t printed anything, and I yes I am 100% sure it was the playerGUI, I have to keep things a bit discrete you know

i did a big dumb dumb, if the parent changes to nil, the script is no longer in playergui so cant print

move the script next to the Frame and write

local frame = script.Parent.Frame
frame:GetPropertyChangedSignal('Parent'):Connect(function()
 print(frame.Parent)
end)
1 Like

now it just printed nil, nothing unexpected

did this happen immediatly or after a certain action? this can tell is where/when/what is causing it

almost immediatly, no action was performed resulting in the reparenting

://///////////////////////////////////////////////////////////

local player:Player = players.LocalPlayer or players.PlayerAdded:Wait()

when other players join, PlayerAdded is fired too. your sure its referencing the right player?

otherwises there must be something destroying it from somewhere somehow…

is it possible to copy and strip the game to its bare bones and send a file with the basic scripts?
and have you tried renaming the Frame to something less generic? Feels like that wont change anything but, its worth a shot since this is clearly not behaving logically

I even tried commenting out all the remote function things, and written all the returned values myself, effectively simulating another player for the returned values, so I am sure that the localPlayer is referenced as it should be

aaaaaaaaaaaaaaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAA

right

disable EVERY SINGLE SCRIPT IN THE ENTIRE GAME, use the command bar to do so if you want

only keep the script i mentioned earlier:

local frame = script.Parent.Frame
frame:GetPropertyChangedSignal('Parent'):Connect(function()
 print(frame.Parent)
end)

and see if the parent still changes

1 Like

that actually worked! Though I have many gui objects in the game and this is the only one experiencing problems, even after changing all the names. I will look through all the client scripts. Thanks for your help!

1 Like