I need help mapping keyboard and mouse controls to Xbox controls. I don’t know how to script and i need help with mapping keyboard keybinds to Xbox controls because i want to add controller support to my game, can you please help me? thank you.
Well, you could do that, but what I meant by the post was you could create keybinds for computer (Like shift for sprint) but also make one for console (Like L2 to sprint).
If I misunderstood what you were going for, then please correct me
Ok, so what i meant is that when i press the A button on my Xbox controller, it would press the W key instead, and i wonder if thats possible? Thank you.
local UserInputService = game:GetService("UserInputService")
local function onInputBegan(input, _gameProcessed)
if input.UserInputType == Enum.UserInputType.ButtonA or Enum.UserInputType.W then
print(“Worked”)
end
end
UserInputService.InputBegan:Connect(onInputBegan)
Like this??
This will print “Worked” whenever you press the A button on your xbox OR the w button on your keyboard.
No, what i meant is transforming xbox controls to keyboard keys like for example, on Steam there is a feature where you can make it where when you press the A button on your xbox controller, it press the W key.
Oh. I don’t know why you would need to convert the keys to keyboard unless you are making a typing feature, but in this case, I guess you could just use the same code I just gave you.
What it does is it makes the A button on xbox result in the same action that would have happened when you press the W button on keyboard.
Can you explain to me why you need to do this / what it is for?
I need this because i am working on a battle royale game and i obviously dont know how to script but i might understand some basic code and i am using the Ruddev’s battle royale open source game as my primary game and to make it easier for people to play the game with a controller, i decided to go with that method.