If player name then visible

I make script that if player name is there then frame visible

game.Players.PlayerAdded:Connect(function(player)

local locked = player:WaitForChild("PlayerGui").Shop.MainFrame.Halos:WaitForChild("Black Frame")
local main = locked.Locker

local function CheckName()
	if player.Name == "DylTheDeveloperX" == true then
		main.Visible = false
	end
	if player.Name == "DylTheDeveloperX" == false then
		main.Visible = true
		end
		
	end
	CheckName()
end)

Untitled

So what do you want? If you want to show people what you have made probably put it in #help-and-feedback:cool-creations

Remove the == true and == false from those if statements, they should be

if player.Name == "Dy1TheDeveloperX" and if player.Name ~= "Dy1TheDeveloperX"

Still not working… can someone help me?

What type of script is it and where is it located? And are you getting any errors, you didn’t detail anything about waht was going on

its located on locker parent … also i dont get any error

Untitled

Localscripts wont have time to detect your player being added, but it will work for others, change it into a server script in ServerScriptService and fix the code around to make it work

game.Players.PlayerAdded:Connect(function(player)

	local locked = player:WaitForChild("PlayerGui").Shop.MainFrame.Halos:WaitForChild("Black Frame")
	local main = locked.Locker
	
	print(player.Name)
	
	if player.Name == "DylTheDeveloperX" then
		main.Visible = false
	else
		main.Visible = true
	end
end)

ok…
i tryed to add print

game.Players.PlayerAdded:Connect(function(player)

	local locked = game.StarterGui.Shop.MainFrame.Halos:WaitForChild("Black Frame")
	local main = locked.Locker

	local function CheckNames()
		if player.Name == "DylTheDeveloperX" then
		main.Visible = false
		print("Dylan Is Here!")
		else
		main.Visible = true
		print("Dylan Is Not Here")
		end
	end
	CheckNames()
end)

print only works but the locker still not…

Why did you change it to game.StarterGui, that will not work until a Respawn because StarterGui replicates everything in it to PlayerGui on Respawn in a sense, you didn’t need to change it, use how I did

ok done i revert it and add again that

the errors says

Shop is not a valid member of PlayerGui "Players.DylTheDeveloperX.PlayerGui"

Wait for it to exist before doing anything, local locked = player:WaitForChild("PlayerGui"):WaitForChild("Shop").MainFrame.Halos:WaitForChild("Black Frame")

still the same only prints work but the error gone but the locker still visible…

Can you please learn basics of scripting? because its hard for us to explain you…

also use WaitForChild()

For example:

local locked = player:WaitForChild("PlayerGui"):WaitForChild("Shop"):WaitForChild("MainFrame"):WaitForChild("Halos"):WaitForChild("Black Frame") || player.PlayerGui.Shop.MainFrame.Halos["Black Frame"]

Printing can help debug why it’s doing that, maybe your name doesn’t match up,

game.Players.PlayerAdded:Connect(function(player)

	local locked = player:WaitForChild("PlayerGui"):WaitForChild("Shop").MainFrame.Halos:WaitForChild("Black Frame")
	local main = locked.Locker

	print(player.Name)
	
	if player.Name == "DylTheDeveloperX" then
		main.Visible = false
		print("Dylan Is Here!")
	else
		main.Visible = true
		print("Dylan Is Not Here")
	end
end)

still not i think i need to use function…

Function or no function it still will still not work, maye you’re making the wrong thing invisible? What are you trying to make invisible?

the locker because behind of locker is equip button.

I understood that the frame will be visible for all the players when you join, right?

yes for all it will visible edited

Then why is it making it visible for everyone else besides you? It makes it invisible for you but visible for everyone else