-
What do you want to achieve? I want to check to see if an input from a controller are the same
UserInputState
as a player’s current keybinds. -
What is the issue? Trying to get
UserInputStates
from my keybind table in a module script results in them turning into strings. (I’m guessing the strings are theEnum.Name
values of the entered Enums)
For more context here, I run this module function whenever I get a start or an end to an input, which then checks to see if something should happen based on a table in the same module with the enum values.
module.PlayerKeybinds
automatically turns into module.DefaultKeybindings
before this runs. (If the table was empty when the function run, it would give an error)
module.DefaultKeybindings = {
["Keyboard+Mouse"] = {
["Jump"] = Enum.KeyCode.Space,
},
["Controller"] = {
["UI Vibration"] = {
["Active"] = true,
["Amount"] = .15
},
["HamburgerMenu"] = {
["KeyCode"] = Enum.KeyCode.DPadDown,
["ActivationTime"] = "End"
},
["UI Select"] = {
["KeyCode"] = Enum.KeyCode.ButtonA,
["ActivationTime"] = "Begin"
}
}
}
module.PlayerKeybinds = {}
module.ControllerInputResponse = function(input,ui)
local inputType = input.UserInputType
if module.CheckInputIsController(inputType) == true then
for bindingName, bindingInfo in pairs(module.PlayerKeybinds.Controller) do
print(bindingName,bindingInfo)
print(typeof(bindingInfo["ActivationTime"]))
if bindingName == "UI Select" and bindingInfo["KeyCode"] == input.KeyCode and bindingInfo["ActivationTime"] == inputStateString then
module.ButtonsActivatedFunctions["Hamburger"](ui)
end
end
end
end
The line with print(typeof(bindingInfo[“ActivationTime”]) prints string
- What solutions have you tried so far? I have looked this up and found nobody with a similar issue.
Thanks for help!