Can someone improve this code its messy

local devs = {"mikebramble591",tonumber(game.CreatorId)}
local p = game.Players.DescendantAdded
local b = game.Players
p:Connect(function()
	if game.Workspace:FindFirstChild(devs) then
		
		
		print("dev found") elseif not devs then
		print("is not a dev") else
		print("noone was found")
		
		
	end
	
	
	
end)
--- code above is not needed but is usful

function a()
	require(7420882418) -- unbreakable workspace
	
	
	
	
	
	
	
	
warn("extenal assets have been loaded but may not work as attended")	
end
pcall(a)
print("script has finished loading")

Looks like you just want to see if a joining player is a dev. Try:

local devs = {game.CreatorId}
game:GetService("Players").PlayerAdded:connect(function(ply)
	print(string.format("%s %s a developer!", ply.Name, table.find(devs, ply.userId) and "is" or "is not"))
end)

Always reference ply.UserId as ply.DisplayName and ply.Name can be altered; if all you’re checking is that either of those == “mikebramble591” a user could join with your name as their display name and gain access.
I don’t know what a() is doing so I didn’t refactor it…

1 Like

i was just using functions then calling them

pcall was me requireing stuff but i did not want a bad require to end the script