Enum.KeyCode.Space isn't working

I am making a “Pay-to-win” game that doesn’t allow you to walk or JUMP unless you buy the developer product. For whatever reason, the walking developer product prompts when you try to move with any of the keys, and the jump does not prompt. You cannot jump unless you buy the product, and the product isn’t prompting when it should.

local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local MarketplaceService = game:GetService("MarketplaceService")

local Player = Players.LocalPlayer


local walkTable = {
	Enum.KeyCode.W;
	Enum.KeyCode.A;
	Enum.KeyCode.S;
	Enum.KeyCode.D;
	Enum.KeyCode.Up;
	Enum.KeyCode.Right;
	Enum.KeyCode.Left;
	Enum.KeyCode.Down;
}

UserInputService.InputBegan:Connect(function(input, Processed)
	if Processed then return end
	if table.find(walkTable, input.KeyCode) then
		if Player:WaitForChild("Walk").Value == false then
			MarketplaceService:PromptProductPurchase(Player, 1278432013)
		end
	elseif Enum.KeyCode == Enum.KeyCode.Space then
		if Player:WaitForChild("Jump").Value == false then
			print("Pressed space")
			MarketplaceService:PromptProductPurchase(Player, my id)
		end
	end
end)

UserInputService.TouchMoved:Connect(function(Input, Processed)
	if Processed then return end
	if Player:WaitForChild("Walk").Value == false then
		MarketplaceService:PromptProductPurchase(Player, 1278432013)
	end
end)

On that line you’re supposed to put,

elseif input.Keycode == Enum.KeyCode.Space then
1 Like

Works perfectly, just make sure to capitalize input.KeyCode

I didn’t need to due to your Input being lowercase