Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I check if someone pasted something into the chat?

I want a thing so I if someone pastes something into the chat then it would print what they pasted .

I'm not sure where to start, so if anyone can give me an example it would be great

1 comment

0

Not possible.

2 answers

✓ Accepted answer

Check if the textbox is changed, and if CTRL + V is being held down at the same time.

local chatbox = game:GetService('Players').LocalPlayer.PlayerGui.Chat.Frame.ChatBarParentFrame.Frame.BoxFrame.Frame.ChatBar;

local UserInputService = game:GetService('UserInputService');

chatbox.Changed:Connect(function()
	if (UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) or UserInputService:IsKeyDown(Enum.KeyCode.RightControl)) and (UserInputService:IsKeyDown(Enum.KeyCode.V)) then
		print(chatbox.Text)
	end
end)
local chatbox = game:service'Players'.LocalPlayer.PlayerGui.Chat.Frame.ChatBarParentFrame.Frame.BoxFrame.Frame.ChatBar
if chatbox then
	chatbox.Changed:Connect(function()
		print(chatbox.Text)
	end)
end

6 comments

0

ps. only works on localscript (so your going to have to fireserver or something)

0

wouldnt that print every letter they type?

0

Yes, there is no method to detect a clipboard paste, unless you got the difference from the text in the box then the text in the box after a change and if it is more than 2 characters you can probably say its pasted.

0

can u give me an example for that?

0

Use userinputservice and check for CTRL + V held at the same time.

0

can i have an example?

This discussion is preserved as it was. New answers, comments, and votes are closed.