![]() I tried something like this, but function always ‘updates’ when I ‘press’ any button on the keyboard or mouse. UserInputService.InputBegan:Connect(Input) Local function Input(input, gameProcessedEvent)Įlseif IsShiftKeyDown() and SpeedValue_3 <= 1 then Return UserInputService:IsKeyDown(ShiftKey) Is there any possible way how am I going to track player’s speed? If you think there is, please reply! Though, once I release the shift button and start walking, my player won’t walk, he will run (play run animation). I tried placing the function that tracks player’s speed in the function for Input. ![]() I don’t want to use loops for tracking, because loops grow lag in the game. So, I need some sort of help, to detect or track player’s speed in the function for Input. When player’s current speed is 0 or player is in idle form, but he is still holding a button for running, he won’t play run animation. When player starts walking and then starts holding LeftShift, he will start playing run animation, but if player stops walking or running(WASD) and holds LeftShift, run animation will still play, which I don’t want to happen. If inputState = and SpeedValue_3 > 1 thenĬ = SpeedValue_1Įlseif inputState = and SpeedValue_3 < 3 thenĬ = SpeedValue_2Įlseif inputState = then Game:GetService('ContextActionService'):BindAction("ShiftSprint", function(actionName, inputState, inputObj) local SpeedValue_1 = 25Ĭ:Connect(function(SpeedValue_4) ![]() My question is “How can I detect if player is still holding a button?” Let’s get into the details. I have a small problem, that is actually really hard for me to solve.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |