[SUPPORT NEEDED] Roblox | Hover Over Player for UserID system

I would like to make a system where you can hover over another player in the server and press control+c and it will copy their username in () and userID… This is using a textlable/box with the mouse function… We have tried a few times with no luck please help if you can!

intorsetorpolice1, Development Team
Popsiz Development Team

Tag of frappe dev: @lizziescatboy


Can you show us your script? Also, are you using a localscript or normal script?

1 Like

local and

local Player = game:GetService("Players").LocalPlayer;
local Mouse = Player:GetMouse();
local UIS = game:GetService("UserInputService");
local RS = game:GetService("RunService");

local Gui = Instance.new("ScreenGui", Player:WaitForChild("PlayerGui"));
local Label = Instance.new("TextLabel", Gui);
Label.Size = UDim2.new(0, 100, 0, 10);
Label.AnchorPoint = Vector2.new(0.5, 0.5);
Label.BackgroundTransparency = 1
Label.TextColor3 = Color3.fromRGB(255, 255, 255)
Label.TextTransparency = 0.2
Label.TextScaled = false

RS:BindToRenderStep("MouseHover", Enum.RenderPriority.Camera.Value - 1, function()

	local mPos = UIS:GetMouseLocation();
	Label.Position = UDim2.new(0, mPos.X, 0, mPos.Y);

	local Target = Mouse.Target;

	if Target then
		if Target.Parent then
			if Target.Parent:IsA("Model") and not (Target.Parent == workspace) then
				local tPlayer = game:GetService("Players"):GetPlayerFromCharacter(Target.Parent);
				if tPlayer then
					Label.Text = tPlayer.Name .. '\n' .. tPlayer.UserId
					Label.Text = ''
				Label.Text = ''
			Label.Text = ''
		Label.Text = ''


Anyone else have any idears? or @signupredirectlol @clv2


I don’t think Roblox scripts can access to clipboard of a computer. Would be very dangerous otherwise. Imagine what could be added in without the player’s knowledge.

The best workaround would be a textbox that doesn’t erase on focus which would allow players to manually copy the string.

1 Like

I want to do that but idk how… could you help?


The script does work, but it won’t on yourself due to how Mouse.Target works.
If you want to convince yourself, run a server and not a Solo Testing session


I personally placed the script in StarterPlayerScripts.
I can also see some small possible tweaks to optimize the script so if you want that just tell me.

please go ahhead… with taht nad give me the optimize if u can

You can use a TextBox object that is has TextEditable set to true. You can focus on the text by using TextBox:CaptureFocus() aswell as TextBox:ReleaseFocus() which will force your client to focus on the text inside and stop focusing on the text. To select a portion of the text, you can use TextBox.SelectionStart (start of the selection) and TextBox.CursorPosition (end of the selection).

Hope this helps!

1 Like