I was told that if u wanted a KeyDown/KeyCode script to be in your game you would have to direct it to everyone in that game. But i've seen a bunch of other games where this isn't true. Here is a script for an Ex.
Player = game.Players.LocalPlayer Mouse = Player:GetMouse() Mouse.KeyDown:connect(function(Key) if Key == "r" then print("you have pressed r") end end) --note that everyone can press r for "you have pressed r" to appear in the output-- --I know KeyDown is deprecated, so if you have a KeyCode you can do that instead--
Just check if the LocalPlayer's name is the name of the certain player you want to give it to
local UIS = game:GetService('UserInputService') local player = game.Players.LocalPlayer UIS.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.R and player.Name == 'chexyalani' then print('chexyalani has pressed R') end end)