--------------------------------------------------------------------------------------
--------------------[ GAMEPAD CONTROLS ]---------------------------------------------------
--------------------------------------------------------------------------------------
local userInputService = game:GetService("UserInputService")
userInputService.InputChanged:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Gamepad1 then
if input.KeyCode == Enum.KeyCode.ButtonX then
Reloading = true
if input.UserInputType == Enum.UserInputType.Gamepad1 then
if input.KeyCode == Enum.KeyCode.ButtonB then
Knifing = true
end
if input.UserInputType == Enum.UserInputType.Gamepad1 then
if input.KeyCode == Enum.KeyCode.ButtonL1 then
ThrowingGrenade = true
end
if input.UserInputType == Enum.UserInputType.Gamepad1 then
if input.KeyCode == Enum.KeyCode.ButtonL2 then
Aiming = true
end
if input.UserInputType == Enum.UserInputType.Gamepad1 then
if input.KeyCode == Enum.KeyCode.ButtonY then
if Stance == 0 then
Stance = 1
end
if input.UserInputType == Enum.UserInputType.Gamepad1 then
if input.KeyCode == Enum.KeyCode.ButtonY then
if Stance == 1 then
Stance = 3
end
✓ ANSWER ACCEPTED
End of a if statement coming up with an error How to fix it?
1 answer
✓ Accepted answer
I decided to clean up your code, making all syntax correct. This does NOT mean the following code will work, as your question was only about the end's.
--------------------------------------------------------------------------------------
--------------------[ GAMEPAD CONTROLS ]---------------------------------------------------
--------------------------------------------------------------------------------------
local userInputService = game:GetService("UserInputService")
userInputService.InputChanged:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Gamepad1 then
if input.KeyCode == Enum.KeyCode.ButtonX then
Reloading = true
elseif input.KeyCode == Enum.KeyCode.ButtonB then
Knifing = true
elseif input.KeyCode == Enum.KeyCode.ButtonL1 then
ThrowingGrenade = true
elseif input.KeyCode == Enum.KeyCode.ButtonL2 then
Aiming = true
elseif input.KeyCode == Enum.KeyCode.ButtonY then
if Stance == 0 then
Stance = 1
elseif Stance ==1 then
Stance = 3
end
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
Tip: Tab your code properly and place ends in the proper places.
... where are these "Proper Places"?
you need to have an end for every if statement...
... and for every function your creat I.e. "connect(function() end)" or "function Test() end" etc.