Check if the player has a certain ID

game.Players.PlayerAdded:Connect(function(player)
	print(player.UserId)
	local pl = (player.UserId)
	if pl == 142874436 then
		script.Parent.Text = "Creator"
	else
		script.Parent.Text = "Customer"
	end
end)

Why does this script not print my USER-ID or change the text to Creator.

1 Like

Better off using this. Not sure if PlayerAdded in a local script counts the LocalPlayer.
Or runs in a local script.

local player = game.Players.LocalPlayer
local pl = player.UserId

if pl == 142874436 then
	script.Parent.Text = "Creator"
else
	script.Parent.Text = "Customer"
end
1 Like

How would I get the Username then?

Yes, that’s how you would get the UserId.

I meant the username, (I need both)

local name = player.Name
1 Like
local player = game.Players.LocalPlayer

--gets the name
local Name = player.Name

--gets the userid
local ID = player.UserId