I have elementary os 5.0 Loki installed on a Dell Latitude e6410. This machine will not stay awake whether it's on battery or plugged in! I will go and set the sleep time to never in power settings for both battery and plugged in and it will still just go to sleep after a while. The one thing that is remarkable about the hardware, as far as I know, is that the laptop has a Nvidia GPU and we have had a fair amount of problems getting a proper driver for it. I'm familiar with alot of basic things in Linux but because I am not in Linux every day, there are alot of things I don't know. Any guidance would be appreciated.
It's known bug: https://github.com/elementary/switchboard-plug-power/issues/89
Try this workaround:
dbus-launch gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type nothing