So I just wanted to know a few stuff about lua, here are my questions;
- How Would I Do Key Code Combinations?
My best guess for this question is something like this;
local uis = game:GetService('UserInputService') uis.InputBegan:Connect(function(input) if input = Enum.KeyCode.Z and if input = Enum.KeyCode.Y then --code end end)
So I'm not sure.
- How would I make it so that if a person presses this KeyCode a certain amount of times in a certain time?
So I would say something like press W twice to sprint but he has to press it within 2 seconds?
- How Would I Detect If a player is Holding A key down or Holding a click?
I have absolutely no idea on how. But I know it's possible because in some games you can charge stuff my holding.
Please help me.
Thank you for reading.
With this list on the wiki.
Use tick()
. If you don't know, tick returns the current unix time. Unix time is the number of seconds since January 1, 1970 and is how computers tell time. You can use this and subtraction to find out how long something took.
local lastInput = tick() uis.InputBegan:Connect(function(input) if tick() - lastInput <= 2 then print("double click") end lastInput = tick() end)
That's ez pz. When the input begins, set a boolean to true. When the input ends, set it to false. Now you just have to check that value.