Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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

0
Not possible. DeceptiveCaster 3761 — 5y

2 answers

Log in to vote
0
Answered by
Fifkee 2017 Community Moderator Moderation Voter
5 years ago
Edited 5 years ago

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)
Ad
Log in to vote
0
Answered by 5 years ago
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
0
ps. only works on localscript (so your going to have to fireserver or something) User#28313 0 — 5y
0
wouldnt that print every letter they type? LEWIS1063 6 — 5y
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. User#28313 0 — 5y
0
can u give me an example for that? LEWIS1063 6 — 5y
View all comments (2 more)
0
Use userinputservice and check for CTRL + V held at the same time. Thepoint13 99 — 5y
0
can i have an example? LEWIS1063 6 — 5y

Answer this question