For the Gui you don’t need to use true or false. You need to index Gui or path to it, so the only requirement is it needs to be ImageButton or TextButton. Image, Text, Size, Position, Color and many more are your choice. If you don’t want them to be visible on PC then make Visible = false. For the Guis, you need to thank @Kotium_I
Hey I am trying to make my crouch system use your module instead of contextactionservice and I am having a bit of trouble making it work. I am using this code to test and it doesn’t seem to print anything at all. Please let me know if I did something wrong which is why it isn’t working.
Code: (This is in a local script)
local KeyHandler = require(game:GetService("ReplicatedStorage"):WaitForChild("Modules"):WaitForChild("Keybinds"))
KeyHandler.Keys[1] = {
Keys = {"Q"}, --required
Func = function(state, ht)
if state == "began" then
print("worked")
else
print("no")
end
end, --required
}
Thanks in advance
Edit: Found out you have to do KeyHandler:Start() lol. Also what does the “ht” parameter do and what does it stand for?
Adding a way so 2 different keys can activate the same function without having to press them both at the same time for the function to start.
State Change. Example:
From this:
if State == "began" then
to this:
if State == Enum.UserInputState.Begin then
Excited to use this module and figure out its full potential and I hope these suggestions help! (I can try and explain better if you don’t understand the first suggestion.)
ht = hold time.
Long story short, time between button press and release(between InputBegan and InputEnded)
I used “began” and “ended” for tables:
local Actions = {
began = function()
--code
end,
ended = function()
--code
end,
}
Actions[state]()
but I fugured out that, unless you use more than 5 items in table, if else statements are faster
2 items in table < if else(Win)
5 items in table(Win) > if else
So, I think I will change State name.
And about first suggestion, I understood it. Something like that:
I will add both of your suggestions, but right now I’m working on my own game and for my game I need “GlobalKey”(you will see what it is when I finish it)
I’m stuck at update right now. So guess what, I give up?
Nah, I will rewrite whole module just to contain new features.
If be honest I just reread my code and it’s not OOP. I don’t really know OOP, but I will learn it(the features I want is “type” and “constructors”, they are easy to implement, however I will add any feature that I will consider useful from OOP). I will optimize my code as much as possible.
Hey, module looks good. But I think it would make more sense to have one table that contains the index as the key and the value as the function instead of 2 tables. Like so
Hmm. I can do that. It will takemath.random(2, 4)days
It’s not big deal, but my PC is broke, it shut downs itself every 30 minutes, which lowers my efficiency
Do you know what causes this error? If so that would help me a ton in fixing it. It happens whenever my character respawns, and I feel it’s also important to note that I have CharacterAutoLoads turned off.