for screenshots, capture the viewport like texture, flip it v, create a unique path for every file (pic) and save it
let u this for inspiration.

func _on_Screenshoot_pressed():
	var path = createPath()
	var image = get_viewport().get_texture().get_data()
	image.flip_y()
	image.save_png(path)
	yield(get_tree(), "idle_frame")
	$Fundo/ScreenPath.set_text(str(OS.get_user_data_dir()) + "/screenshoots/" + str(new_name)) # label

func createPath():
# "user://screenshoot111111.png"
	var time = OS.get_datetime()
	var hour  = str(time["hour"])
	var minute = str(time["minute"])
	var second = str(time["second"])
	var day = str(time["day"])
	var month = str(time["month"])
	var year = str(time["year"])
	new_name = hour + minute + second + day + month + year
	var new_path = "user://screenshoots/" + str(new_name) + ".png"
	return new_path

    Zelta
    Thank you for your reply, this is a good way to get screenshots, but what I want is a way to forbid screenshots

      Can I ask what the reason is? Yes, there are ways to do it with native apps, but I don't think that is exposed with Godot. However, if I understand what you were trying to do, maybe there is another solution.

        cybereality
        similar “Draw Something”. youtuber drawing, audience guessing
        Youtuber can see the words, but don't want the audience to see it.

        (I know this requirement is not common, but I just want to know if it can be implemented in the script layer or engine layer)

        Oh cool. You know I used to work at the studio that made Draw Something? I didn't work on that game, but I did some work on the original web game Draw My Thing before they ported it to mobile and changed the name.

          Ok, but that is a design question of the streaming application.

          What is not sent and drawn at the clients PC can not be captured.

          Or I am totally confused now.

          Anyway, what's drawn by a game engine or any graphics api at the local PC can be captured. With Vulkan, even what's not drawn can be captured.

          So no, that won't be possible. You cannot really block the screen (or portions of the screen) in a Godot app, from what I understand. Even with OS libraries, you can only really block the entire app (used for DRM or copyright protection) so that's not useful either.

          What you could do is have two separate windows for the app. One window would be the one the streamer can record, and the other would be their private window (they can drag this onto another monitor, or just put it in the corner). Sadly, Godot 3.x does not support multiple windows. It looks like Godot 4.0 will, but I'll have to check if that works yet.

          If you want to try this with the current stable versions of Godot 3.4.4, you'd need to use networking. So you'd be creating two apps. One is the actual game, and the other is just a small app to display private text or messages. See the docs here for how to network two apps.

          https://docs.godotengine.org/en/stable/tutorials/networking/high_level_multiplayer.html

            Could one have users with superpowers to sign in, and thus be shown the secret word ? The unprivileged rest would have to guess ...

              Pixophir
              Because the audience can actually see the entire interface of the youtuber, and I want the audience can only see part of the interface.
              So your plan doesn't work

              cybereality
              I did consider this plan,
              But it would be better if there was a way to hide the display of a certain area, so this discussion was initiated.
              As you said, it's impossible to hide a certain part, even DRM just makes the whole screen invisible
              So I closed this discussion, thanks for your help
              Pixophir cybereality @Zelta

              Some possibilities:
              1 - streaming software like OBS can define a region of the screen, window, etc to stream. The player could manually crop the area to not show the words. That relies on the player to do the work though.
              2 - Print the hidden words to the console. Exported projects don't have a console window of their own, but if you run a Godot game from the command line it attaches to that console and anything you send to the print function will go to that window. The player can drag the console to another monitor.
              3 - Also in OBS, you can add image overlays that cover parts of the screen. Most streamers are probably used to that, for things like logos, watermarks, etc.

              All require at least some effort from the player though.

                Kojack
                Thanks for your help, both are very reliable methods.
                Of course, it would be better if players didn't need to put in the effort

                Even if you prevent screenshots, you could take a photo of the screen using a separate camera.

                  DaveTheCoder
                  Yes, I just want to prevent parts of the game from being streamed to other viewers

                  vmjcv

                  uh sorry, i did only read 'screeenshots' XD

                  maybe just put some image to block the clued words when streaming? (OBS allow you to put a picture on the streaming screen (:з」∠))