local code = game.Players.LocalPlayer.codes.inventory.Value
function onKeyPress(inputObject, gameProcessedEvent)
if gameProcessedEvent then return end
if inputObject.KeyCode == Enum.KeyCode[code] then
if script.Parent.Visible == true then
script.Parent.Visible = false
else script.Parent.Visible = true
end
end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)
this is supposed to let the player choose multiple keycodes for opening their inventory. i only have the guis ready for q and i, but i ran into this problem. it doesnt update the variable when i change the source of the variable. basically, it would change the variable if i put the entire script inside a while loop, but the problem is that with the wait in the while loop, i would have a limited amount of time to press the key.

3 comments
well now there is a new issue, edited question
The question has not been edited.
i didnt think you wouldreply so quickly, but its edited now