ContextActionService gives six unidentified inputs at startup?

Hey there. The title is self explanatory but I just wanted to ask if any of you are having this problem. I think I know how to fix it.

I am not clicking any keys at all

This is the output when I start the game
  20:29:02.209  None  -  Client - AshawayController:43
  20:29:02.210  Cancel  -  Client - AshawayController:44
  20:29:02.210  0, 0, 0  -  Client - AshawayController:45
  20:29:02.210  0, 0, 0  -  Client - AshawayController:46
  20:29:02.210  Enum.KeyCode.Unknown  -  Client - AshawayController:47
  20:29:02.210  nil  -  Client - AshawayController:50
  20:29:02.211  None  -  Client - AshawayController:43
  20:29:02.211  Cancel  -  Client - AshawayController:44
  20:29:02.211  0, 0, 0  -  Client - AshawayController:45
  20:29:02.212  0, 0, 0  -  Client - AshawayController:46
  20:29:02.213  Enum.KeyCode.Unknown  -  Client - AshawayController:47
  20:29:02.214  nil  -  Client - AshawayController:50
  20:29:02.215  None  -  Client - AshawayController:43
  20:29:02.215  Cancel  -  Client - AshawayController:44
  20:29:02.215  0, 0, 0  -  Client - AshawayController:45
  20:29:02.215  0, 0, 0  -  Client - AshawayController:46
  20:29:02.216  Enum.KeyCode.Unknown  -  Client - AshawayController:47
  20:29:02.216  nil  -  Client - AshawayController:50
  20:29:02.217  None  -  Client - AshawayController:43
  20:29:02.218  Cancel  -  Client - AshawayController:44
  20:29:02.219  0, 0, 0  -  Client - AshawayController:45
  20:29:02.220  0, 0, 0  -  Client - AshawayController:46
  20:29:02.221  Enum.KeyCode.Unknown  -  Client - AshawayController:47
  20:29:02.222  nil  -  Client - AshawayController:50
  20:29:02.222  None  -  Client - AshawayController:43
  20:29:02.222  Cancel  -  Client - AshawayController:44
  20:29:02.222  0, 0, 0  -  Client - AshawayController:45
  20:29:02.223  0, 0, 0  -  Client - AshawayController:46
  20:29:02.223  Enum.KeyCode.Unknown  -  Client - AshawayController:47
  20:29:02.223  nil  -  Client - AshawayController:50
  20:29:02.223  None  -  Client - AshawayController:43
  20:29:02.223  Cancel  -  Client - AshawayController:44
  20:29:02.224  0, 0, 0  -  Client - AshawayController:45
  20:29:02.224  0, 0, 0  -  Client - AshawayController:46
  20:29:02.224  Enum.KeyCode.Unknown  -  Client - AshawayController:47
  20:29:02.224  nil  -  Client - AshawayController:50 ```

I don’t even have a cancel button on my keyboard and I am not touching anything.

Code:

-- LINE 40
local function SelectSpell(Spell,InputState,Input: InputObject)
	
	print(Input.UserInputType.Name)
	print(Input.UserInputState.Name)
	print(Input.Delta)
	print(Input.Position)
	print(Input.KeyCode)
	
	AshawayController.SelectedSpell = InfoModule.AshawaySpells[AshawayController.SelectedElement][Input.KeyCode]
	print(AshawayController.SelectedSpell)
end

Video:

Hi there, can you provide the functions that call the SelectSpell function? It would assist in any further debugging.

Alright then.

Here is what the script looks like now.

I all I needed to do was a check to see whether or not the inputs was the one I was looking for. I think it might either be a bug or my keyboard might be broken or something.

I don’t really need a solution just thought if any of you know why it might be happening.


local function SelectSpell(Spell,InputState: Enum.UserInputState,Input: InputObject)
	if InputState == Enum.UserInputState.Begin then
		if Spell == "Melee" then
			AshawayController.SelectedSpell[1] = "Melee" -- If I am not using a spell
			return
		end
		AshawayController.SelectedSpell = {
			InfoModule.AshawaySpells[AshawayController.SelectedElement][Input.KeyCode].Name, -- Don't worry about this stuff I am checking the info module to see what spells are a part of that element so I can cast them later.
			Input.KeyCode.Name
		}
	end	
end

-- These functions run at startup
    ContextActionService:BindAction("Projectile",SelectSpell,true,Enum.KeyCode.R)
	ContextActionService:BindAction("Area Of Effect",SelectSpell,true,Enum.KeyCode.F)
	ContextActionService:BindAction("Enchantment",SelectSpell,true,Enum.KeyCode.V)
	ContextActionService:BindAction("Melee",SelectSpell,true,Enum.KeyCode.T)
	

This does not happen for me. Code used:

-- LocalScript under StarterPlayerScripts
local ContextActionService = game:GetService("ContextActionService")

local function printAction(actionName)
	print(actionName)
end

ContextActionService:BindAction("Action1", printAction, true, Enum.KeyCode.R)
ContextActionService:BindAction("Action2", printAction, true, Enum.KeyCode.F)
ContextActionService:BindAction("Action3", printAction, true, Enum.KeyCode.V)
ContextActionService:BindAction("Action4", printAction, true, Enum.KeyCode.T)

Nothing prints out at all during startup. I have to press either R, F, V, or T to print anything.