Printing KeyCode issue?

I ran into a weird issue when messing around with userinputservice and didnt exactly know how to fix it?

LocalScript:

local uis = game:GetService(“UserInputService”)

local repStore = game:GetService(“ReplicatedStorage”)

uis.InputBegan:Connect(function(input, processed)

if input.UserInputType == Enum.UserInputType.Keyboard then

repStore.PartSpawn:FireServer(input.KeyCode)

end

end)

Script:

local uis = game:GetService(“UserInputService”)
local repStore = game:GetService(“ReplicatedStorage”)

local function spawnPart(player, input)
if input == Enum.KeyCode.E then
local brick = Instance.new(“Part”, workspace)
brick.Position = Vector3.new(0,20,0)
elseif input == Enum.KeyCode.Q then
local sphere = Instance.new(“Part”, workspace)
sphere.Shape = Enum.PartType.Ball
sphere.Position = Vector3.new(0,20,0)
end
print(player … " pressed the " … uis:GetStringForKeyCode(input) … " key!") --where the issue is
end

repStore.PartSpawn.OnServerEvent:Connect(spawnPart)

It keeps outputting: “ServerScriptService.Script:13: attempt to concatenate Instance with string” and it wont print out anything besides that.

You might wanna try using if input.KeyCode == Enum.KeyCode.E.
I don’t see the point of detecting if the input is from a keyboard or not too, you could just check the input on the Local Script and then fire on the server.

You are trying to get a string with an Instance, try switching the inputs that are on your server script to input.KeyCode.