plr.Name vs plr.UserId

If I use plr.Name can it get hacked? Basicly some guy was able to do this

They used a remote event I believe and I wrote plr.Name instead of plr.UserId. This was just a way to give myself the pet.

I made a security check if the name was mine.


game.ReplicatedStorage.GameClient.Events.RemoteEvent.GivePet.OnServerEvent:Connect(function(Plr, CodeName)
	
		
	if Plr.Name == "FelixProfit" then
		Pet(Plr,CodeName)
		
	else
		Plr:WaitForChild("leaderstats").Fizz.Value -= 10000000000000000000000000
		Plr:WaitForChild("leaderstats").Rebirths.Value -= 10000000000000000000000000
	end
	
end)

2 Likes

There is no difference. The only problem will be if your checking it from the server or not.

1 Like

Yeah I was checking in client and in server.

Changing it on client won’t replicate it to server.

So if you do checks on server, it wouldn’t matter which you use.

I personally would choose UserID for accuracy though.

You should always be using a player’s user ID because it will never change. And when checking on the server only rely on the player Instance that is returned.