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)
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)
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)
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
Wait for it to exist before doing anything, local locked = player:WaitForChild("PlayerGui"):WaitForChild("Shop").MainFrame.Halos:WaitForChild("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)