How To use UserId?

Hello!

Basically, I’m trying to fire a remote everytime a Player with a certain PlayerId presses a button. I’ve tried game.Players.LocalPlayer.PlayerId, but it doesn’t seem to work. It errors with “PlayerId is not a valid member of Player”

You use UserId and not PlayerId
game.Players.LocalPlayer.UserId

1 Like

Sorry, don’t know why I used PlayerId. :man_shrugging:

In the future, try to check the DevHub before making a topic here. If you’d looked up PlayerId on the DevHub, you would’ve found out it’s not a property, and UserId is what you should be using instead.
https://developer.roblox.com/en-us/api-reference/property/Player/UserId

3 Likes

I did, no worries. But for some reason I thought I was using UserId. My brain be like that sometimes.

1 Like