Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

HOW TO MAKE IT SO PRESSING A BUTTON WHILE TYPING DOESNT ACTIVATE SCRIPT?

Asked by 6 years ago
Edited 6 years ago

I want to make it so that when you press R while typing, the run script does not activate.

local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()
local origSpeed = 16
local character = Player.Character
local humanoid = character.Humanoid

game:GetService('UserInputService').InputBegan:Connect(function(input, process)
       if input.UserInputType == Enum.UserInputType.Keyboard then
           if input.KeyCode == Enum.KeyCode.R and Player and character and humanoid.WalkSpeed == origSpeed  then
        Player.Character.RUNSCRIPT.SPEED.Disabled = false
Player.Character.Anima.Disabled = true
Player.Character.RUNANIMATION.Disabled = false

        elseif input.KeyCode == Enum.KeyCode.R and humanoid.WalkSpeed == Player.Character.RUNSCRIPT.RunSpeed.Value then
         humanoid.WalkSpeed = origSpeed
       Player.Character.RUNSCRIPT.SPEED.Disabled = true
    Player.Character.RUNANIMATION.Disabled = true
Player.Character.Anima.Disabled = false
        end
    end
    end)
0
In your line 8, put 'and not process' after .Keyboard User#19524 175 — 6y

1 answer

Log in to vote
-1
Answered by 6 years ago

Make line 8 like this.

if input.UserInputType == Enum.UserInputType.Keyboard and not process then
0
The second parameter doesn't actually check if they are typing, however, that is one reason it may be true. Use GetFocusedTextBox. hiimgoodpack 2009 — 6y
0
Thanks! It works now :) NikkoTheJesusMan 3 — 6y
0
^^ The second prometer checks if the typing is being processed elsewhere. True if so. User#19524 175 — 6y
Ad

Answer this question