Roblox User Input System is Equating Mouse Movement to Keyboard Input

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make my game only recognize a keystroke rather than mouse input

  2. What is the issue? Include screenshots / videos if possible!
    Roblox User Input System is Equating Mouse Movement to Keyboard Input

		if input.UserInputType == Enum.UserInputType.Keyboard and input.UserInputType ~= Enum.UserInputType.MouseMovement then
			for i, v in pairs(clonedLoadingScreen:GetDescendants()) do
				if v:IsA("Frame") then
					tweenService:Create(v, TweenInfo.new(3), {BackgroundTransparency = 1}):Play()
				elseif v:IsA("TextLabel") or v:IsA("TextButton") then
					tweenService:Create(v, TweenInfo.new(1), {TextTransparency = 1}):Play()
				elseif v:IsA("ImageLabel") or v:IsA("ImageButton") then
					tweenService:Create(v, TweenInfo.new(3), {ImageTransparency = 1}):Play()	
				end
			end
		end 
  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub? I’ve tried passing “input.UserInputType ~= Enum.UserInputType.MouseMovement” through the if statement and no result

print(input.UserInputType)
end

if input.UserInputType == Enum.UserInputType.MouseMovement then
for i, v in pairs(clonedLoadingScreen:GetDescendants()) do
if v:IsA(“Frame”) then
tweenService:Create(v, TweenInfo.new(3), {BackgroundTransparency = 0}):Play()
elseif v:IsA(“TextLabel”) or v:IsA(“TextButton”) then
tweenService:Create(v, TweenInfo.new(1), {TextTransparency = 0}):Play()
elseif v:IsA(“ImageLabel”) or v:IsA(“ImageButton”) then
tweenService:Create(v, TweenInfo.new(3), {ImageTransparency = 0}):Play()
end
end
end

if input.UserInputType == Enum.UserInputType.MouseButton1 then
for i, v in pairs(clonedLoadingScreen:GetDescendants()) do
if v:IsA(“Frame”) then
tweenService:Create(v, TweenInfo.new(3), {BackgroundTransparency = 1}):Play()
elseif v:IsA(“TextLabel”) or v:IsA(“TextButton”) then
tweenService:Create(v, TweenInfo.new(1), {TextTransparency = 1}):Play()
elseif v:IsA(“ImageLabel”) or v:IsA(“ImageButton”) then
tweenService:Create(v, TweenInfo.new(3), {ImageTransparency = 1}):Play()
end
end
end
end)

1 Like

I had to make a seperate if statement for its original if statement

	if script.Parent.Visible and input.UserInputType == Enum.UserInputType.Keyboard then

Well you are still welcome say thank you.

1 Like

thank you for replying! Good Sir!

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