I tried to make a local script about UserInputService, my first script is:
local player = game.Players.LocalPlayer local UIS = game:GetService("UserInputService") mouse = player:GetMouse() UIS.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.Keyboard then print("you're pressing down a key") end end) UIS.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.KeyBoard then print("you stopped pressing a key") end end)
but when i pressed play, i got an error: Keyboard is not a valid EnumItem
after that, i made another script:
local player = game.Players.LocalPlayer local UIS = game:GetService("UserInputService") mouse = player:GetMouse() UIS.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then print("you're pressing down a key") end end) UIS.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then print("you stopped pressing a key") end end)
I changed Keyboard to MouseButton1 and it works perfectly fine What is the problem here?