How to make UserInputService for a certain player?

I want to know how to make a keybind thing for a certain player. So like only one player can use it

1 Like

Are you referring to a random player in the server or an admin?

I guess I’ll choose random. I just wanna know how

Lets say you want to give a specific player the keybind. You would need to use an if statement.

Example: (Local Script)

if game.Players.LocalPlayer.Name == "cheesestring237" then
-- The code would run.
end
2 Likes

This works but I would recommend having a table.

local AccessPlayers = {
"cheesestring237";
"Player1";
"Player2";
}

if table.find(AccessPlayers,game.Players.LocalPlayer.Name) then

end
1 Like

You can store the local script in Server Storage, and then clone and parent it to the player’s PlayerGui, even this way will work.

I wouldn’t recommend putting this on the client side (exploiters can easily access these)