If statement not working

im trying to make that when a billboard guiisnt visible another billboardgui will be visible

the problem is that nothing happens when the billboardgui isnt visible and the print isnt working either.

there are no errors

local Player = game:GetService('Players').LocalPlayer

Player.CharacterAdded:Wait()

local Inv2 = script.Parent.Parent.Inv2
local Inv3 = script.Parent.Inv3
local Inv4 = script.Parent.Parent.Inv4

game:GetService("RunService").RenderStepped:Connect(function()
	if Inv2.Visible == false then
		Inv3.Visible = true
		print("working")
	else
		Inv2.Visible = true
		Inv3.Visible = false
	end
end)

Are you sure there’s no errors? I’d assume the script would still be repeating itself if it would still be working (If not, just check your Output or change the script to a LocalScript if you haven’t already)

Or add a couple more prints to check what exactly works

where in the game is the script? Is it a local or server script?

Can you show us the location of the script in the Explorer? Do you want the BillboardGui’s visibility to show to all players (use a Script) or only to the LocalPlayer/Client (use a LocalScript)

yes im sure that there are no errors and its a local script

its a local script inside startergui

the script is a local script inside of startergui

Can you add a couple more prints then to check what issue you’re exactly having? Cause it seems like it may run fine

i did this:

local Player = game:GetService('Players').LocalPlayer

Player.CharacterAdded:Wait()

print("charAdded")
local Inv2 = script.Parent.Parent.Inv2
local Inv3 = script.Parent.Inv3
local Inv4 = script.Parent.Parent.Inv4


game:GetService("RunService").RenderStepped:Connect(function()
	if Inv2.Visible == false then
		Inv3.Visible = true
		print("working")
	else
		Inv2.Visible = true
		Inv3.Visible = false
	end
end)

print("RenderStepped")

But no prints are working

Remove this, This one line is pausing the rest of your script from continuing.

This isn’t a fix, but I would suggest you put wait() somewhere in RenderStepped.

In order for your script to work you first need to remove the “Player.CharacterAdded:Wait()” Since it just stops your script from working completely as it just waits there.
image
Then do something like this or something. RunService triggers everytime theres movement meaning that too much changes will cause it to crash. So waits are needed, and you would have to change some values to true or false later on otherwise it would just be one thing always visible as there are no changes.

I dont think the renderstepped is necessary because i just wanted it to check constantly and i didnt want to use while true do so i used renderstepped

Then your main error of nothing printing or having no errors in the output would just be as simple as removing

but when i remove that then i have an error Inv2 is not a valid member of PlayerGui

That would mean, Your billboard Gui or whatever it is called “Inv2” isn’t part of PlayerGui meaning it doesn’t exist. I was wondering earlier but your Inv2 and Inv4 both have an extra parent in it while Inv3 only has 1.

Inv 2 and Inv 4 are both imagebuttons and they have both an extra parent because they are in a different billboardgui

Mind taking a screenshot of your explorer tab?

Oh you’re missing stuff.

That should work. The buttons are the children of the billboards. Inv2 and inv4 aren’t children of StarterGui