Unfortunately the official way to override button images via userInputService:GetStringForKeyCode won’t work if you want to be able to distinguish between PS4 and PS5 buttons like the share button.
A workaround is to use userInputService:GetImageForKeyCode instead since it returns a different button image for PS4 and PS5.
e.g.
local mappings = {
["rbxasset://textures/ui/Controls/PlayStationController/PS4/ButtonShare@2x.png"] = "rbxasset://PS4_SHARE_BUTTON_ASSET",
["rbxasset://textures/ui/Controls/PlayStationController/PS5/ButtonShare@2x.png"] = "rbxasset://PS5_SHARE_BUTTON_ASSET"
}
local mappedKey = userInputService:GetImageForKeyCode(key)
local image = mappings[mappedKey] or mappedKey
imageLabel.Image = image
Not the safest way since if roblox decides to change the image path then it’ll fail, though at worst it’ll just revert back to using the default image supplied by roblox.
What should expect emulating ps5 , like in same behavior of emulating ps4 ? I’d that would be cool if everyone would kindly emulating ps4 and ps5 at what best at kind.
Ah, will you plan to support controller gyroscope in the future? I was hoping for this to be added day 1 so developers can implement gyro aiming in their first person shooter games. Energy Assault already has gyro aiming on mobile devices.
I think most people don’t see a game app on ps4 console like i cannot see myself on brothers ps4 console, and i think that problem persist me from not having a ps4 pro, we only have normal ps4, and that’s how the problem occured when i don’t see it on playstation store
Is it intentional for the selections w/ controller for UI to break if a billboard GUI is attached to an attachment?
You get a warning in output when attempting to select said GUI “Setting GuiService.SelectedObject to invalid GuiObject” and still select the desired object, but can not select any adjacent GUI’s even if you provide a selection group or provide left/right/up/down directions
Can we bring back the music on ps and xbox menu like you heard before if mostly relieved my likeness for music back again, i don’t think it will work on new music but in different synchros, i don’t think would take it far back like from 2016, and i think it would been fit pretty cool through the menu back again for music is like a taste.
Off topic, but rumble doesn’t work on the ps5 controller. I have to use an Xbox controller emulator for it to work, but then the icons are back to the Xbox ones.
I’m trying to use this API to effectively support non‑QWERTY keyboards, QWERTY keyboards, and gamepads as you show in the OP. However, when using my QWERTY keyboard, with the API, it returns a blank string. I do not have access to an non‑QWERTY keyboard.
I thought this was a bug, but it’s apparently intentional behavior. To respond to @idevride here, my expectation is that the Enum.Keycode prints to the correct button for the user to press no matter what keyboard or gamepad they have. I shouldn’t have to check if the user has a non‑QWERTY keyboard or if they have a different gamepad. If I have a QWERTY keyboard, LeftShift should return “LeftShift”.
Here’s a feature request about the issue, from 2022: Expand Keys for UserInputService:GetStringForKeyCode. The OP there assumes the issue is a lack of support in the API for all the KeyCodes, yet the bug report I mention above would oppose that. If the intentional behavior is to print out an empty string, that should be changed. The issue with this is that I do not have access to the Feature Request categories, and yes I have requested to join the @AllowFeatureRequests group. It’s not really taking people in right now.
This issue is impacting my game and I can’t fix the issues of the wrong prompts being shown to users without making my own system. If someone at Roblox could reply to this issue as soon as possible, that’d be great.
Thanks,
Reditect
Edit 6/8/2024:
I’ve removed support for non-Qwerty keyboards from my game because of this API. I am using a Qwerty keyboard. When using the API, I get a blank string. That means my players see blank prompts in dialogue and whatnot. I’d rather support Qwerty than no keyboards at all. I am still using the API for gamepad however, that works fine.
Bump, this is out of my control. I will continue to bump before the 4 month closing period on this topic until I (or someone else) can make a feature request or staff responds.
local UserInputService = game:GetService("UserInputService")
local textLabel = script.Parent
local mapKey = Enum.KeyCode.ButtonA
textLabel.Text = "press the " .. UserInputService:GetStringForKeyCode(mapKey) .. " to do something"