#input thinks any input is valid

1 messages · Page 1 of 1 (latest)

timid helm
#

i'm trying to make it so that it only detects leftshift as a valid input but it just keeps detecting any input and it's really annoying idk how to fix it.

RS.Heartbeat:Connect(function(player)
    if Debounce then return end
    UIS.InputBegan:Connect(function(input, gameProcessedEvent)
        
        if gameProcessedEvent then return end
        if input.KeyCode == keyBind then
            if not Running then
                Debounce = true
                bindable:Fire()
                startRun()
                if not keyBind then
                    return end
                end
                
            else
                Anim:Stop()
                Humanoid.WalkSpeed = 16
                
                UIS.InputEnded:Connect(function(input, gameProcessedEvent)
                    if Anim.IsPlaying and Humanoid.MoveDirection.Magnitude < 0.5 then
                        Anim:Stop(0.25)
                        Humanoid.WalkSpeed = 16
                    end
                end)
            end
        task.wait(1)
        Debounce = false
    end)
end)
near venture
#

Try using it without runservice

timid helm
#

okie dokie

#

it didn't work

#

it's still detecting every input as valid

glossy zephyr
#

what are you trying to achieve with your script

timid helm
#

i'm trying to fix it

#

LOL

#

should i rewrite it-

#

it got kinda messy while i was trying to fix it.

glossy zephyr
#

what are you tryna do tho

timid helm
#

also memory leak? how would it do that? sry i only started scripting some weeks ago.

glossy zephyr
#

you keep making a new input connection

timid helm
glossy zephyr
#

what is the keybind variable

timid helm
#

enum.keycode.leftshift

glossy zephyr
#

i see

finite geyser
#

maybe remove rs.heartbeat or that?

timid helm
#

i akready did

#

it didn't work

glossy zephyr
#

honestly rewriting is better at this point

timid helm
#

yeah i was thinking that

#

hmmm

glossy zephyr
#

a shift to sprint script right

timid helm
#

yes

twin palmBOT
#

studio** You are now Level 2! **studio

timid helm
#

just

#

i'm confused about

#

that

#

like

glossy zephyr
#

also

timid helm
#

i press WASD and it thinks that's sprinting but it doesn't actually sprint

glossy zephyr
#

does your game have shiftlock as shift or ctrl

timid helm
#

well shift cuz idk how to change it to ctrl but

#

i don't have shiftlock enabled

#

when playing

#

like u can enable it but idk i haven't been using it

#

should i change it to ctrl?

finite geyser
#

doesnt rlly make a difference

timid helm
#

okay

finite geyser
#

just annoying lol

timid helm
#

yeah i could imagine.

#

i have a print statement for if sprinting is true or false and uh

#

whnever i just

#

walk normally

#

it sytarts printing true that's how i know that

#

it#s determining any input

#

which is weird

finite geyser
#

i do sprint like when the player presses shift

timid helm
#

is there any way to make it stop doing that or should i just ignore the print statements?

#

that's what i was trying to do

#

i swear i wrote it correctlty

glossy zephyr
#
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local uis = game:GetService("UserInputService")

local keybind = Enum.KeyCode.LeftControl -- change if you'd like

local humanoid = char:WaitForChild("Humanoid")

uis.InputBegan:Connect(function(input, gpe)
    if gpe then return end
    if input.KeyCode ~= keybind then return end
    
    humanoid.WalkSpeed = 25 -- sprint speed
end)
uis.InputEnded:Connect(function(input, gpe)
    if gpe then return end
    if input.KeyCode ~= keybind then return end

    humanoid.WalkSpeed = 16 -- default speed
end)

#

i wrote a quick script

#

that speeds you up while holding the keybind

#

and when you release it slows you back down

timid helm
#

oh wait wth? it can do that?

#

that's crazy

#

is that what ~= is?

#

thx btw heh

glossy zephyr
#

~= means not equal to

timid helm
#

oh yeah

#

i forgot

#

it does mean that

glossy zephyr
#

if the input.keycode doesn't equal to the keybind it just doesn't continue with the input thing

timid helm
#

alright thanks

glossy zephyr
#

👍

timid helm
#

oh man i was looking for that idk how i forgot it existed

#

thx tho it rlly helps

glass axle
timid helm
#

oh shi