Inputbegan that take any key still fires when player is typing

i ahve this issue that my input began still fires when player is typing in the chat

here the script:

local UIS = game:GetService("UserInputService")
local abilityss, specity = require(game.ReplicatedFirst.ListOfEverythingForMoves_Ability), require(game.ReplicatedFirst.ListOfEverythingForMoves_Spec)
local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local abilidtycode, speccode = player:WaitForChild("Data").Stand, player:WaitForChild("Data").Spec
local keymoves = require(game.ReplicatedFirst.MOVES).Movess
local Char = player.Character
local checked = require(player.Backpack.Setup:WaitForChild("valuescontrols"))

local remote = script.Parent.Remotes.Move_Spec
local remote2 = script.Parent.Remotes.Move_Ability

local function startInput(Input, d, t)
	if Input and Input ~= t then
		if d == "spec" then
			local standName = specity[speccode.Value];
			local StandMoveset = keymoves[standName]

			if not StandMoveset then return end
			local MoveName = StandMoveset[Input]

			if not MoveName then return end
			if checked.canattackb(player) then return end

			remote:FireServer(Input, true)
		elseif d == "ability" then
			local standName = abilityss[abilidtycode.Value];
			local StandMoveset = keymoves[standName]

			if not StandMoveset then return end
			local MoveName = StandMoveset[Input]

			if not MoveName then return end
			if checked.canattackb(player) then return end

			remote2:FireServer(Input, true)
		end
	end
end

local function Endinput(Input, d)
	if d == "spec" then
		local standName = specity[speccode.Value];
		local StandMoveset = keymoves[standName]

		if not StandMoveset then return end
		local MoveName = StandMoveset[Input]

		if not MoveName then return end
		if checked.canattackb(player) then return end

		remote:FireServer(Input, false)
	elseif d == "ability" then
		local standName = abilityss[abilidtycode.Value];
		local StandMoveset = keymoves[standName]

		if not StandMoveset then return end
		local MoveName = StandMoveset[Input]

		if not MoveName then return end
		if checked.canattackb(player) then return end

		remote2:FireServer(Input, false)
	end
end
UIS.InputBegan:Connect(function(input, proccessed)
	if (not proccessed) then
		input = input.KeyCode.Name
		task.spawn(function()
			startInput(input, "ability", proccessed)
		end)
	end
end)

UIS.InputEnded:Connect(function(input)
	input = input.KeyCode.Name
	task.spawn(function()
		Endinput(input, "ability")
	end)
end)

is on client side btw

1 Like

HELLO?:moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai:AAAAAA f

Maybe try to put if proccessed then return end in the UIS.InputEnded function?
like so:

UIS.InputEnded:Connect(function(input,proccessed)
	if proccessed then return end
	input = input.KeyCode.Name
	task.spawn(function()
		Endinput(input, "ability")
	end)
end)

I tested it out and for me it worked

The solution that Valkyrop provided is indeed the correct way to handle this, but I figured I’d give a little insight as to why that works:

The InputEnded event has 2 parameters when fired; the InputObject and a boolean which indicates if the game engine has internally acted on this input, when you are typing in the in- game chat for example.

TL;DR processed = true means the game engine already acted on it, such as typing in chat.

@Valkyrop @YP501 it did work what you all saying, thanks fr fr

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.