For some reason when I use my script. it says :W001: unkown global "UserInputType" can someone help? here's my script:
01 | local UIS = game:GetService( "UserInputService" ) |
02 | local Human = game.Players.LocalPlayer.Character:WaitForChild( "HumanoidRootPart" ) |
03 | local Part = game.Workspace.EPart |
04 | UIS.InputBegan:connect( function (input) |
05 | if UserInputType = = Enum.UserInputType.Keyboard then |
06 | if input.KeyCode = = Enum.KeyCode.E then |
07 | if (Part.Position - Human.Position).magnitude < 20 then |
08 | print ( "Your pressed E in a magnitude 20 of a part.. congrats?" ) |
09 | end |
10 | end |
11 | end |
12 | end ) |
You are using UserInputType
in the wrong context.
You will want to replace that line with:
1 | if input.UserInputType = = Enum.UserInputType.Keyboard then |
instead.
On a side note, connect
is deprecated so use Connect
instead.