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

Is there any way to disable pasting into a textbox?

I'm working on a typing test game - and my current biggest issue is the fact that it is possible to copy/paste into a textbox.

I want to use pre-selected quotes, but this is getting in the way.

Any suggestions?

2 comments

0

Who's going to play a typing test game and cheat?

0

That's what's sad. People will cheat in anything if I put a high score or any incentive to it. Or even just to brag.

1 answer

✓ Accepted answer

i don't know if you got a separate box for typing in. but this is the script for the typing box. it works unless they click inside the text box to try to type. it'll be endless if they keep clicking in the box to type in.

local plr = game.Players.LocalPlayer
local box = plr.PlayerGui.Gui.Frame2.TextBox
local penalty = false
local time = 5 -- time you want to penalize them
function onKeyPress(inputObject)
if inputObject.KeyCode == Enum.KeyCode.LeftControl or inputObject.KeyCode == Enum.KeyCode.RightControl then
	box.Text = "No Pasting Allowed"
	penalty = true
		end

if penalty == true then
		
		
		box.ClearTextOnFocus = false
		repeat 
		box.Text = "You can't Type for " ..time.. " seconds"
		wait(1)
		time = time - 1
		until box.Text == "You can't Type for 0 seconds"
		
			penalty = false
			box.ClearTextOnFocus = true
			box.Text = "You can type now"
			time = 5 -- set this back to the number
			end
	end
	
game:GetService("UserInputService").InputBegan:connect(onKeyPress)

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