GetImageForKeyCode() does not work, no error

I tried the EXACT same example from here on a fresh new project: Gamepad APIs: Cross-Platform Button Support

This is where I put the LocalScript:
image

There’s no image applied when playing the game. The placeholder stays. There is no error and the execution of code is not paused.

You mean this example?

local userInputService = game.UserInputService
local imageLabel = script.Parent
local key = Enum.KeyCode.ButtonA

local mappedIcon = userInputService:GetImageForKeyCode(key)
imageLabel.Image = mappedIcon

Printing mappedIcon should output the correct id. If so, then the image most likely can’t be seen on the white canvas. Make it transparent or change the background colour, and configure the frame colour/opacity too.

The default icons are white for easier costumization.

1 Like