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 the function from going when the player starts typing?

When i player types( the kind of type when they press "/" and say type word with there keyboards") it runes the UIS script that is supposed to work when a player presses a key. Although even when they type(by pressing "/") it still runes that UIS script. How can i stop this from happening?

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

1 answer

✓ Accepted answer

If you don't want the function to continue it's execution when a player types the '/' key then you can check the InputObject and check if it's equal to the back slash or slash KeyCode.

Try adding something like this on the first line of the functions block

If Input.KeyCode == Enum.KeyCode.Slash or
    Input.KeyCode == Enum.KeyCode.BackSlash then
    return
end

2 comments

0

'If' needs to be all lowercase on line 1

0

Lol yeah.. I was typing on a phone that has a laggy keyboard.

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