Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

InputBegan Error for userrinput service?

Asked by 4 years ago

Ok so I have been getting this error called attempt to index nill with input began Here is code!

Error: 11:14:42.934 - userInputService.InputBegan:Connect(function(input,gpe) 11:14:42.943 - if input.KeyCode == Enum.KeyCode.LeftControl then 11:14:42.944 - print("Correct input") 11:14:42.945 - crouch() 11:14:42.945 - end 11:14:42.946 - end) 11:14:42.946 - 11:14:42.946 - script.Parent.Crouch.MouseButton1Click:Connect(function() 11:14:42.947 - crouch() 11:14:42.947 - end) 11:14:42.948 - 11:14:42.948 - game.ReplicatedStorage.Togg:1: attempt to index nil with 'InputBegan'

Code which it is in: userInputService.InputBegan:Connect(function(input,gpe) if input.KeyCode == Enum.KeyCode.LeftControl then print("Correct input") crouch() end end)

script.Parent.Crouch.MouseButton1Click:Connect(function() crouch() end)

game.ReplicatedStorage.ToggleCrouch.OnClientEvent:Connect(function(visiblity) script.Parent.Crouch.Visible = visiblity for i , v in pairs(player.Character.Humanoid:GetPlayingAnimationTracks()) do v:Stop() end player.Character.Humanoid.WalkSpeed = 16 animPlaying = false script.Parent.Crouch.ImageColor3 = Color3.fromRGB(255,255,255) script.Parent.Crouch.TextLabel.BackgroundColor3 = Color3.fromRGB(255,255,255) end)

By the way, this is an Alvin Blox tutorial but he has not covered this error so I'm asking help from here!

0
Please use a code block. Dovydas1118 1495 — 4y
0
Dovy what is a code block AviaFlyHigh 15 — 4y

Answer this question