Ad
Log in to vote
1

UserInputService InputChanged doesn't fire on Keyboard inputs? [Sorta-Fixed]

Asked by
adark 5487 Badge of Merit Moderation Voter Community Moderator
8 years ago

I'm trying to alter my key binding code to make it use InputChanged rather than a combination of InputBegan and InputEnded to make adding new binds easier, but InputChanged seems to be only firing on MouseWheel and MouseMovement UserInputTypes, only.

if not uis.TouchEnabled then
    uis.InputChanged:connect(function(inst)
        print(inst.UserInputType)
        if inst.UserInputType == Enum.UserInputType.Keyboard then
            local key = inst.KeyCode
            local fal = inst.UserInputState == Enum.UserInputState.Begin and true or false
            --snop keycodes for binds junk
        elseif inst.UserInputType == Enum.UserInputType.MouseWheel then
            --TODO: Zooming stuff
        end
    end)
else
    --TODO: Touch Controls
end

~~Is there any workaround for this?~~

Turns out InputBegan/Ended doesn't trigger MouseWheel or MouseMovement.

Sucks for me. :/

0
You need to use the PlayerMouse object. I couldn't write a script right now because I'm on mobile. OniiCh_n 410 — 8y
0
No I don't. The UserInputService exactly what I need to use, it's just that the Changed event doesn't fire for bobs that use the Beging and Ended events, and vice versa. adark 5487 — 8y

Answer this question