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

Why my anti copy paste script won't work when typing in the chat?

Asked by
royee354 129
6 years ago
Edited 6 years ago

So I have 2 scripts one sets a boolvalue to true while holding down "ctrl" and one that only works when the value is set to true and it activates if you click "v" aswell, it kills the player.

script1:
Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()
Mouse.KeyDown:connect(function(key)
if key:byte() == 50 then
print("keypressed")
script.Value.Value = true
end
end)
Mouse.KeyUp:connect(function(key)
if key:byte() == 50 then
script.Value.Value = false
print("keyunpressed")
end
end)
script2:
Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()
Mouse.KeyDown:connect(function(key)
if script.Parent.AntiCP.Value.Value == true then
if key:byte() == 118 then
repeat wait() until Player.Character
Character = Player.Character
Character.Humanoid.Health = 0
print("keypressed")
end
end
end)

It will work fine when I don't type in the chat, but while trying to copy paste in the chat it won't work.

0
Please format your code properly. Additionally, what is the point of trying to stop someone from copying and pasting? Avigant 2374 — 6y
0
It is for my wand system I don't want people copy pasting spells to cast faster. royee354 129 — 6y
0
I edited it so you can read it, can you help? royee354 129 — 6y
0
You should really indent your code. Also, Mouse.KeyDown and Mouse.KeyUp are deprecated. Also RBXScriptSignal:connect() is deprecated, use RBXScriptSignal:Connect(), also use local Character = Player.Character or Player.CharacterAdded:Wait(), also call Instance:WaitForChild() for the character's humanoid. Use UserInputService instead of mouse events. Avigant 2374 — 6y
View all comments (4 more)
0
And an exploiter can still copy and paste if they want to, you wouldn't be able to stop that, just worth saying. Avigant 2374 — 6y
0
Can you help me solve my problem please, Instead of telling me different methodsthat will give me the exect same result, I don't want to sound rude, but I would like to know why this code won't work while typing in the chat. royee354 129 — 6y
0
Hi why would I call Instance:WaitForChild() for character's humanoid, please tell me because it might teach me something AdventurousHeight 5 — 6y
0
Adven it is to find the character's humanoid the wait for child thingy is for waiting for humanoid to be inserted into the character it prevents errors sometimes royee354 129 — 6y

Answer this question