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

How can I stop a player from using there move when there typing?

This is my script. Thanks:

local Player = game.Players.LocalPlayer
local char = Player.Character
local den = true
local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(Input)
    if Input.KeyCode == Enum.KeyCode.Q then
if not den then return end
den = false
local Part = Instance.new("Part")
Part.Parent = workspace
Part.CFrame = char.Head.CFrame * CFrame.new(0,0,-5)
wait(3)
den = true

2 comments

0

I don't understand your question or your problem. Please explain thoroughly what your problem is.

0

Do you mean they cant move while pressing “Q”? You could temporarily set walkspeed to 0 or Platformstand them...

1 answer

✓ Accepted answer

If you're talking about stopping your code when the player types in chat/ a textbox, yes

InputBegan has 2 parameters,

  • Input (InputObject)

  • gameProcessedEvent (bool)

You need the second one for this (gameProcessedEvent)

It basicly returns true when typing in chat/a textbox

Example

local UIS = game:GetService('UserInputService')

UIS.InputBegan:Connect(function(Input ,gameProcessedEvent)
	if gameProcessedEvent then
		return --// So the code stops running
	end
end)

If you don't understand something/I made a typo or so, just ask

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