OnServerEvent implicitly receives the client who fired the remote as the first parameter. Your server is actually receiving three arguments because of this and the third argument is getting dropped because it can’t be assigned to a variable. Remove the LocalPlayer bit from FireServer.
Thanks, it now prints “Enum.KeyCode.W” or something like that, so how would I get it to only print the character and have it remove the Enum.KeyCode part?
Yeah @colbert2677 is correct, the method :FireServer the additional arguments put in as the server automatically identified the player who fired the event through the first parameter of your :Connect(function()) as OnServerEvent works like:
where the automatically passed parameter of player has been named to “player” but the second parameter of “player” which you passed has been named to “Input”.
Hey, for some reason whenever I run the script and type the letter O or the letter I, it doesn’t print, but whenever I type any other letter it works.
Here is the script again
local RE = game.ReplicatedStorage.Input
RE.OnServerEvent:Connect(function(Player, Input)
if #game.Players[Player.Name]:GetChildren() < 4 then
local Folder = Instance.new("Folder")
Folder.Parent = game.Players[Player.Name]
local StrValue = Instance.new("StringValue")
StrValue.Parent = game.Players[Player.Name].Folder
end
if Input.Value >= 97 and Input.Value <= 122 or Input.Value == 32 then
print(Input.Name)
end
end)
This is a separate issue. If you’re testing in Studio make sure the “Respect Studio shortcuts when game has focus” option is disabled. Studio observes these keys for the camera and Studio shortcuts have precedence over developer keybinds.
Player arguement is passed by default to the server, the reason the username is printed is cause the server sees (player, localPlayer, input) and prints the local player instance which you reference as input, to fix it only pass the keycode to the server by doing RE:FireServer(input.KeyCode).