PyAutoGui isn't pressing "enter"

Question:

I’m trying to get python to automate sending a message in Roblox and it’s typing out the message, but it’s not sending it by pressing "enter", it’s only pressing "space".

I watched a ton of videos on how to get it to press enter and I also tried different keys to see which one would be enter but nothing worked. I’m trying to get it so send a randomized message from a list every 1 – 2 minutes. Here’s my code:

import pyautogui
import time

time.sleep(5)
pyautogui.write("/Test", interval = 0.1)
pyautogui.press('enter')
Asked By: v_y

||

Answers:

Try this in your IDE, than if it works try it inside Roblox.

import pyautogui
import time
import random

messages = ["Hello!", "How are you?", "Nice to meet you!"]
time.sleep(5)

while True:
    message = random.choice(messages)
    pyautogui.typewrite(message, interval=0.1)
    pyautogui.press('enter')
    time.sleep(random.uniform(60, 120))
Answered By: Mime
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.