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

End of a if statement coming up with an error How to fix it?

Asked by 8 years ago
--------------------------------------------------------------------------------------
--------------------[ 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
3
Tip: Tab your code properly and place ends in the proper places. M39a9am3R 3210 — 8y
0
... where are these "Proper Places"? Thegrimdeathzombie 40 — 8y
0
you need to have an end for every if statement... pwnd64 106 — 8y
0
... and for every function your creat I.e. "connect(function() end)" or "function Test() end" etc. M39a9am3R 3210 — 8y

1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
8 years ago

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)

Ad

Answer this question