recently I was making my own little library, probably like many other people here…and I was trying to figure out in the wiki, if we could access somehow to the copy, paste, cut, (clipboard) functions of a player.
My aim was to make a function that would have a label (button, box, textlabel), as paramter and would turn it into selectable using mouse&label in-built functions.
Is it possible, and if yes have you got any idea on how to do it?
I do not think this is currently possible. There have been feature requests in the past, such as this one, however they have not been approved or acknowledged properly by staff in regards to being approved.
I don’t believe this is possible, and I don’t think it will ever be possible due to many security reasons. I think the closest we would ever get would be through PluginSecurity
some security reasons this wouldn’t be allowed:
Games could steal (a potential) password a user has copied to their clipboard (for whatever reasons)
Games could set the clipboard to an inappropriate website
Right. I’ve thought about the security reasons, and was thinking of making a clipboard inside the roblox game. Basically, wouldn’t be linked to the real clipboard, and would be only during the session (from when you join the game, to when you leave).
You might be able to make your own clipboard for your plugin. For instance, simple copy/paste of text for the search bar would definitely be possible. The only downfall is it would only work in Studio. You couldn’t copy something from Notepad and paste it into your searchbar.
No, you absolutely cannot do this. You can’t realistically access any functions of a user’s computer from frontend code either, aside from probably the mouse. Then again, the only thing you really need to do is check when input is signalled.
You can create a custom clipboard of course, allow it to be used within your place from GuiObject to GuiObject. You cannot go any further, though.
Currently, the only clipboard access we support is pasting into textboxes using ctrl+V. In the future, we are going to add the ability to select text inside of a textbox and copy it with ctrl+C.
Currently, there are no plans to expose the clipboard as a Lua API. If you want the user to copy or paste something, you will have to create a textbox, focus it (there is a CaptureFocus() method to do this), and instruct them to press ctrl+C or ctrl+V.
Only plain text can be copied/pasted, not rich objects such as images. Textboxes also have a limit of 32 kilobytes of text contents, which will also serve as an upper limit to how much you can copy/paste for now.
This level of functionality will be pretty close to where the web was with clipboards until a few years ago - I’m sure you remember clicking “copy link” only to have a modal dialog pop up with a textbox in it for you to copy from. Only recently did browsers begin allowing pages to directly set your clipboard contents (but never read it without explicit user action).
Edit (July 2021): Selecting text using click and drag (and several other common methods) is supported. Copying text is supported by pressing Ctrl+C. You can force a textbox to become focused and select its contents using a script, then tell the user to copy it.
Out of curiosity, does this mean that users will be able to press shift and use the arrow keys to highlight parts of text inside a TextBox? (in the future)
Yes, and be able to use the mouse to click and drag to form a selection rectangle, or press ctrl+a to select all text. The selection rectangle will be exposed as properties as well so that it can be manipulated in Lua (for example, selecting all the text each time the textbox is focused for easy copying).
I actually was working on a custom TextBox object a long time ago which could select text using ctrl+a and had cursor tweening and would respond to the home and end keys. I would really like to see Roblox get cursor Tweening similar to how Microsoft Word does it. You can take a look at this place. Desktop only, don’t die, because you won’t respawn with it, and I know the blinking is messed up.
I feel like ROBLOX is allowing more and more access to client’s computers for developers. That’s awesome, even if this generates new scamming ways for some malicious people.