Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Am I doing this function correctly? (I'm Beginner)

i'm trying to make it so when a player with the same exact UserID, down below, print. (So basically what i'm trying to do is make something print whenever a player has a assigned UserID) (Sorry if I have bad English)

Code:

if game.Players.LocalPlayer.UserID = "1178643466" then print("Working") end

1 answer

✓ Accepted answer

This should be in a regular script.

local player = game:GetService("Players"):GetPlayerByUserId(1178643466)

game.Players.PlayerAdded:connect(function()
	if player then
		print("Player with userId 1178643466 is in this server! Their name is: " .. player.Name)
	else
		print("Player with userId 1178643466 is not in this server!")
	end
end)

if this helped mark it as answered, any further questions? comment below! :)

1 comment

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.