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

Line 65, script not working? ')' expected (to close '(' at line 17) near 'end'

Asked by 8 years ago
local mouse = game.Players.LocalPlayer:GetMouse()
local running = false
local Head = game.Workspace.Player.Head
local LeftArm = game.Workspace.Player["Left Arm"]
local LeftLeg = game.Workspace.Player["Left Leg"]
local RightArm = game.Workspace.Player["Right Arm"]
local RightLeg = game.Workspace.Player["Right Leg"]
local Torso = game.Workspace.Player.Torso

function getTool()  
    for _, kid in ipairs(script.Parent:GetChildren()) do
        if kid.className == "Tool" then return kid end
    end
    return nil
end

mouse.KeyDown:connect(function (key) -- DeadZone function
    key = string.lower(key)
    if string.byte(key) == 112 then
        running = true
        local keyConnection = mouse.KeyUp:connect(function (key)
            if string.byte(key) == 112 then
                running = false
            end
        end)
        for i = 1,5 do
            game.Workspace.CurrentCamera.FieldOfView = (70+(i*2))
            wait()
        end
        game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 64
        game.Players.LocalPlayer.Character.Humanoid.JumpPower = 150
            local s = Instance.new("Smoke")
            s.Parent = Torso
            s.Opacity = 0.3
            s.Size = 0.2
            local pl = Instance.new("PointLight", Torso)
            pl.Parent = Torso
            pl.Brightness = 20
            pl.Range = 10
            pl.Color = Color3.new(255, 51, 51)
            Head.Material = ("Neon")
            Head.BrickColor = BrickColor.new("Bright red")
            LeftArm.BrickColor = BrickColor.new("Bright red")
            LeftLeg.BrickColor = BrickColor.new("Bright red")
            RightArm.BrickColor = BrickColor.new("Bright red")
            RightLeg.BrickColor = BrickColor.new("Bright red")
        end
        repeat wait (30) until running == false
        keyConnection:disconnect()
            game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
            game.Players.LocalPlayer.Character.Humanoid.JumpPower = 50
            s.Destroy()
            pl.Destroy()
            Head.Material = ("Plastic")
            Head.BrickColor = BrickColor.new("Pastel brown")
            LeftArm.BrickColor = BrickColor.new("Pastel brown")
            LeftLeg.BrickColor = BrickColor.new("Pastel brown")
            RightArm.BrickColor = BrickColor.new("Pastel brown")
            RightLeg.BrickColor = BrickColor.new("Pastel brown")
        for i = 1,5 do
            game.Workspace.CurrentCamera.FieldOfView = (80-(i*2))
            wait()
        end
    end
end)

')' expected (to close '(' at line 17) near 'end'

0
put a parenthesis after "end" at line 47 aquathorn321 858 — 8y
0
That didn't work either, but thanks for trying! :) Strykebyte 45 — 8y

3 answers

Log in to vote
1
Answered by 8 years ago

Since the function in line 17 is a Anonymous function it should have a closing parentheses after the end of that function. The error Message is basically telling you to add a closing parentheses for the function you created at line 17. I presume that function ends at line 47 so you'll need to change line 47 to end)

0
It didn't work, but thanks for trying ;3 Strykebyte 45 — 8y
Ad
Log in to vote
1
Answered by
gskw 1046 Moderation Voter
8 years ago

Your indentation is wrong, which makes the code confusing.
The problem here is that you've got one "end" too much, the one at line 47. Use this:

local mouse = game.Players.LocalPlayer:GetMouse()
local running = false
local Head = game.Workspace.Player.Head
local LeftArm = game.Workspace.Player["Left Arm"]
local LeftLeg = game.Workspace.Player["Left Leg"]
local RightArm = game.Workspace.Player["Right Arm"]
local RightLeg = game.Workspace.Player["Right Leg"]
local Torso = game.Workspace.Player.Torso

function getTool()  
    for _, kid in ipairs(script.Parent:GetChildren()) do
        if kid.className == "Tool" then return kid end
    end
    return nil
end

mouse.KeyDown:connect(function (key) -- DeadZone function
    key = string.lower(key)
    if string.byte(key) == 112 then
        running = true
        local keyConnection = mouse.KeyUp:connect(function (key)
            if string.byte(key) == 112 then
                running = false
            end
        end)
        for i = 1,5 do
            game.Workspace.CurrentCamera.FieldOfView = (70+(i*2))
            wait()
        end
        game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 64
        game.Players.LocalPlayer.Character.Humanoid.JumpPower = 150
        local s = Instance.new("Smoke")
        s.Parent = Torso
        s.Opacity = 0.3
        s.Size = 0.2
        local pl = Instance.new("PointLight", Torso)
        pl.Parent = Torso
        pl.Brightness = 20
        pl.Range = 10
        pl.Color = Color3.new(255, 51, 51)
        Head.Material = ("Neon")
        Head.BrickColor = BrickColor.new("Bright red")
        LeftArm.BrickColor = BrickColor.new("Bright red")
        LeftLeg.BrickColor = BrickColor.new("Bright red")
        RightArm.BrickColor = BrickColor.new("Bright red")
        RightLeg.BrickColor = BrickColor.new("Bright red")
        repeat wait (30) until running == false
        keyConnection:disconnect()
        game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
        game.Players.LocalPlayer.Character.Humanoid.JumpPower = 50
        s.Destroy()
        pl.Destroy()
        Head.Material = ("Plastic")
        Head.BrickColor = BrickColor.new("Pastel brown")
        LeftArm.BrickColor = BrickColor.new("Pastel brown")
        LeftLeg.BrickColor = BrickColor.new("Pastel brown")
        RightArm.BrickColor = BrickColor.new("Pastel brown")
        RightLeg.BrickColor = BrickColor.new("Pastel brown")
        for i = 1,5 do
            game.Workspace.CurrentCamera.FieldOfView = (80-(i*2))
            wait()
        end
    end
end)
0
Oh wow it worked, thank you very much! :D Strykebyte 45 — 8y
Log in to vote
-1
Answered by 8 years ago

Try this and let me know if it works :)

local mouse = game.Players.LocalPlayer:GetMouse()
local running = false
local Head = game.Workspace.Player.Head
local LeftArm = game.Workspace.Player["Left Arm"]
local LeftLeg = game.Workspace.Player["Left Leg"]
local RightArm = game.Workspace.Player["Right Arm"]
local RightLeg = game.Workspace.Player["Right Leg"]
local Torso = game.Workspace.Player.Torso

function getTool()  
    for _, kid in ipairs(script.Parent:GetChildren()) do
        if kid.className == "Tool" then return kid end
    end
    return nil
end

mouse.KeyDown:connect(function (key)) -- ADDED ANOTHER BRACKET HERE TO CLOSE THE ONE YOU OPENED
    key = string.lower(key)
    if string.byte(key) == 112 then
        running = true
        local keyConnection = mouse.KeyUp:connect(function (key)
            if string.byte(key) == 112 then
                running = false
            end
        end)
        for i = 1,5 do
            game.Workspace.CurrentCamera.FieldOfView = (70+(i*2))
            wait()
        end
        game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 64
        game.Players.LocalPlayer.Character.Humanoid.JumpPower = 150
            local s = Instance.new("Smoke")
            s.Parent = Torso
            s.Opacity = 0.3
            s.Size = 0.2
            local pl = Instance.new("PointLight", Torso)
            pl.Parent = Torso
            pl.Brightness = 20
            pl.Range = 10
            pl.Color = Color3.new(255, 51, 51)
            Head.Material = ("Neon")
            Head.BrickColor = BrickColor.new("Bright red")
            LeftArm.BrickColor = BrickColor.new("Bright red")
            LeftLeg.BrickColor = BrickColor.new("Bright red")
            RightArm.BrickColor = BrickColor.new("Bright red")
            RightLeg.BrickColor = BrickColor.new("Bright red")
        end
        repeat wait (30) until running == false
        keyConnection:disconnect()
            game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
            game.Players.LocalPlayer.Character.Humanoid.JumpPower = 50
            s.Destroy()
            pl.Destroy()
            Head.Material = ("Plastic")
            Head.BrickColor = BrickColor.new("Pastel brown")
            LeftArm.BrickColor = BrickColor.new("Pastel brown")
            LeftLeg.BrickColor = BrickColor.new("Pastel brown")
            RightArm.BrickColor = BrickColor.new("Pastel brown")
            RightLeg.BrickColor = BrickColor.new("Pastel brown")
        for i = 1,5 do
            game.Workspace.CurrentCamera.FieldOfView = (80-(i*2))
            wait()
        end
    end
end)

0
It didn't work, but thanks! c; Strykebyte 45 — 8y

Answer this question