Roblox blocks python clicks

Hello there! Im writing a bot for a game and very often cursor moves only when I move my mouse.
There is a function I use to click:

( ag = pyautogui)
def smoothClick(x,y):
    currentpos = ag.position()
    difx = x-currentpos.x
    dify = y - currentpos.y

    for i in range(2,101):
        perc = i/100
        print((currentpos.x +  difx*perc,currentpos.y+ dify*perc))
        win32api.SetCursorPos((int(currentpos.x +  difx*perc),int(currentpos.y+ dify*perc)))
        sleep(0.000001)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0)
    sleep(30 / 1000)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)

Have you made sure that every variable within your script is defined? Could you send a screenshot of the output log?

There no problem if program. It works without errors. But functions what move cursor are work very laggy in roblox. For example in minecraft it will work without any problem.