well, i lied, i know how to do it, but i was wondering if there was a better way of doing it, because what i had in mind is in doing a variable for every wasd key and changing the varible using iskeydown(). im not sure how to do it otherwise, heres my script
UIS.InputBegan:Connect(function(input)
if (UIS:GetFocusedTextBox()) then
return;
end
if input.KeyCode == Enum.KeyCode.LeftShift and debounce then
debounce = false
Character:WaitForChild("HumanoidRootPart").Velocity = Character:WaitForChild("HumanoidRootPart").CFrame.LookVector * 250
wait(1)
debounce = true
end
end)
https://create.roblox.com/docs/reference/engine/classes/UserInputService#GetKeysPressed
as an alternative to IsKeyDown() you can use this method to get an array of currently pressed keys. then search for your specific keys of interest inside the array
but whats wrong with IsKeyDown()?
You can actually rewrite the
UIS.InputBegan:Connect(function(input)
if (UIS:GetFocusedTextBox()) then
return;
end
...
to
UIS.InputBegan:Connect(function(input, busy)
if busy then return end
...
since InputBegan returns 2 arguments, and the second one is the same thing as checking if the mouse is focused into a textbox
Also
I would guess you can make a guard clause that looks like this if input.KeyCode ~= Enum.KeyCode.KEY
to further clean up your code
1 Like
iskeydawn is a userinput service, which means i have to get it outside the function, im trying to find a way to check the key simultaneously while checking if player is clicking shift or not
why cant you call UIS:IsKeyDown()
inside the function?
huh, i thought iskeydown is a function 
you can call functions inside other functions
1 Like