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

Why won't my scrolling frame scroll when Keydown is activated?

Asked by 9 years ago
game.StarterGui:SetCoreGuiEnabled(4, false)
Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()

Size = script.Parent.AbsoluteWindowSize
RSize = Size/4

Mouse.KeyDown:connect(function(key)
    if key == "e" then
        for i = 1,5 do
        script.Parent.CanvasPosition = script.Parent.CanvasPosition +Vector2.new(Rsize, 0)
        end
        if script.Parent.SelectedTool.Value ~= 4 then
            script.Parent.SelectedTool.Value =  script.Parent.SelectedTool.Value +1
        end
    end
end)
Mouse.KeyDown:connect(function(key)
    if key == "q" then
        for i = 1,5 do
        script.Parent.CanvasPosition = script.Parent.CanvasPosition -Vector2.new(Rsize, 0)
        end 
        if script.Parent.SelectedTool.Value ~= 1 then
            script.Parent.SelectedTool.Value =  script.Parent.SelectedTool.Value -1
        end
    end
end)

Answer this question