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

Wheres the error in my script?

Asked by
Prioxis 673 Moderation Voter
10 years ago

It keeps saying

error at line 144 ')' expected (to close '(' at line 144) near 'end'

here's my script :

local Player = game:GetService("Players").LocalPlayer
local found = game.Workspace:findFirstChild(Player.Name)
if found then
print'character has loaded'
else
while not Player.Character do wait() end
end
local Mouse = Player:GetMouse()
local character = Player.Character
local head = character:FindFirstChild("Head")
local torso = character:FindFirstChild("Torso")
local RightShoulder = torso:findFirstChild("Right Shoulder")
local n = game.Lighting.Light:Clone()
n.Parent = character.Torso
Run = game:getService("RunService")



Mouse.KeyDown:connect(function(key)
    if script.Wait.Value == false then
if key == "f" then
    script.Wait.Value = true
    for i = 1, 2 do
            for i = 1, 12 do
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0.16)
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                Run.Stepped:wait(0.01)
            end
            for i = 1, 12 do
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, -0.16)
                Run.Stepped:wait(0.005)
            end
        end
            for i = 1, 12 do
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                Run.Stepped:wait(0.005)
            end
game:getService("Chat"):Chat(Player.Character.Head, "FireBall!")
local p = Instance.new("Part", Workspace)
p.Color = Color3.new(0, 0, 0)
p.Transparency = 0.5
p.Size = Vector3.new(3, 3, 3)
p.TopSurface = "Smooth"
p.BottomSurface = "Smooth"
p.CanCollide = false
p.Shape = "Ball"
s = script.FD:Clone()
s.Parent = p
s.Disabled = false
p.CFrame = Player.Character.Torso.CFrame*CFrame.new(0, 0, -12)
y = Instance.new("BodyVelocity", p)
y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
y.velocity = Player.Character.Torso.CFrame.lookVector*80
local f = Instance.new("Fire", p)
wait(6)
game.Debris:addItem(p, 1)
script.Wait.Value = false
else print'waiting'
end
end
end)
if Player.spell2.Value == false then
    print'not bought yet'
    else
Mouse.KeyDown:connect(function(key)
    if script.Wait.Value == false then
        if key == "h" then
            game:getService("Chat"):Chat(Player.Character.Head, "Heal!")
            script.Wait.Value = true
            n.Enabled = true

            for i = 1, 12 do
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0.26)
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                Run.Stepped:wait(0.01)
            end
                for i = 1, 12 do
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, -0.26)
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                Run.Stepped:wait(0.005)
                end
                character.Humanoid.Health = character.Humanoid.Health +25
                n.Enabled = false
                script.Wait.Value = true
                wait(5)
                script.Wait.Value = false
        end
    end
end)
if Player.spell3.Value == false then
    print'not bought yet'
    else
Mouse.KeyDown:connect(function(key)
    if script.Wait.Value == false then
if key == "g" then
    script.Wait.Value = true
    for i = 1, 2 do
            for i = 1, 12 do
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0.16)
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                Run.Stepped:wait(0.01)
            end
            for i = 1, 12 do
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, -0.16)
                Run.Stepped:wait(0.005)
            end
        end
            for i = 1, 12 do
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                Run.Stepped:wait(0.005)
            end
game:getService("Chat"):Chat(Player.Character.Head, "FrostBolt!")
local p = Instance.new("Part", Workspace)
p.Color = Color3.new(0, 0, 210)
p.Transparency = 0.5
p.Size = Vector3.new(3, 3, 3)
p.TopSurface = "Smooth"
p.BottomSurface = "Smooth"
p.CanCollide = false
p.Shape = "Ball"
s = script.FD2:Clone()
s.Parent = p
s.Disabled = false
p.CFrame = Player.Character.Torso.CFrame*CFrame.new(0, 0, -12)
y = Instance.new("BodyVelocity", p)
y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
y.velocity = Player.Character.Torso.CFrame.lookVector*80
local f = Instance.new("Fire", p)
f.Color = Color3.new(0, 0, 255)
wait(6)
game.Debris:addItem(p, 1)
script.Wait.Value = false
else print'waiting'
end
end
end)
if Player.spell4.Value == false then
print'hi' 
    else
Mouse.KeyDown:connect(function(key)
    if script.Wait.Value == false then
if key == "b" then
    script.Wait.Value = true
    for i = 1, 2 do
            for i = 1, 12 do
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0.16)
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                Run.Stepped:wait(0.01)
            end
            for i = 1, 12 do
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, -0.16)
                Run.Stepped:wait(0.005)
            end
        end
            for i = 1, 12 do
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                Run.Stepped:wait(0.005)
            end
game:getService("Chat"):Chat(Player.Character.Head, "UnholyBolt!")
local p = Instance.new("Part", Workspace)
p.Color = Color3.new(0, 210, 0)
p.Transparency = 0.5
p.Size = Vector3.new(3, 3, 3)
p.TopSurface = "Smooth"
p.BottomSurface = "Smooth"
p.CanCollide = false
p.Shape = "Ball"
s = script.FD3:Clone()
s.Parent = p
s.Disabled = false
p.CFrame = Player.Character.Torso.CFrame*CFrame.new(0, 0, -12)
y = Instance.new("BodyVelocity", p)
y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
y.velocity = Player.Character.Torso.CFrame.lookVector*80
local f = Instance.new("Fire", p)
f.Color = Color3.new(0, 255, 0)
wait(6)
game.Debris:addItem(p, 1)
script.Wait.Value = false
else print'waiting'
            end
        end
    end
end)

1 answer

Log in to vote
1
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
10 years ago

Your if statement on line 141 will end after the function KeyDown on line 144 will. Line 189 should be end) and line 190 should be end.

After going through and indenting your code correctly, there were a couple missing ends more misplacements like the one that caused your errors. I suggest you go back, indent the code, and make sure the ends line up correctly.

Edits:

Because I don't have all of the objects, such as the spell values in each player the script is calling for, I can't test it completely but it has no more errors dealing with organization.

I also highly suggest you read this wiki page.

local Player = game:GetService("Players").LocalPlayer
local found = game.Workspace:findFirstChild(Player.Name)

if found then
    print'character has loaded'
else
    while not Player.Character do wait() end
end

local Mouse = Player:GetMouse()
local character = Player.Character
local head = character:FindFirstChild("Head")
local torso = character:FindFirstChild("Torso")
local RightShoulder = torso:findFirstChild("Right Shoulder")
local n = game.Lighting.Light:Clone()

n.Parent = character.Torso
Run = game:getService("RunService")



Mouse.KeyDown:connect(function(key)
    if script.Wait.Value == false then
        if key == "f" then
            script.Wait.Value = true
            for i = 1, 2 do
                for i = 1, 12 do
                    RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0.16)
                    RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                    Run.Stepped:wait(0.01)
                end
                for i = 1, 12 do
                    RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                    RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, -0.16)
                    Run.Stepped:wait(0.005)
                end
            end
            for i = 1, 12 do
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                Run.Stepped:wait(0.005)
            end
            game:getService("Chat"):Chat(Player.Character.Head, "FireBall!")
            local p = Instance.new("Part", Workspace)
            p.Color = Color3.new(0, 0, 0)
            p.Transparency = 0.5
            p.Size = Vector3.new(3, 3, 3)
            p.TopSurface = "Smooth"
            p.BottomSurface = "Smooth"
            p.CanCollide = false
            p.Shape = "Ball"
            s = script.FD:Clone()
            s.Parent = p
            s.Disabled = false
            p.CFrame = Player.Character.Torso.CFrame*CFrame.new(0, 0, -12)
            y = Instance.new("BodyVelocity", p)
            y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
            y.velocity = Player.Character.Torso.CFrame.lookVector*80
            local f = Instance.new("Fire", p)
            wait(6)
            game.Debris:addItem(p, 1)
            script.Wait.Value = false
        end
    else print'waiting'
    end
end)

if Player.spell2.Value == false then
    print'not bought yet'
else
    Mouse.KeyDown:connect(function(key)
        if script.Wait.Value == false then
            if key == "h" then
                game:getService("Chat"):Chat(Player.Character.Head, "Heal!")
                script.Wait.Value = true
                n.Enabled = true

                for i = 1, 12 do
                    RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0.26)
                    RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                    Run.Stepped:wait(0.01)
                end
                for i = 1, 12 do
                    RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, -0.26)
                    RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                    Run.Stepped:wait(0.005)
                end
                character.Humanoid.Health = character.Humanoid.Health +25
                n.Enabled = false
                script.Wait.Value = true
                wait(5)
                script.Wait.Value = false
            end
        end
    end)
end

if Player.spell3.Value == false then
    print'not bought yet'
else
    Mouse.KeyDown:connect(function(key)
        if script.Wait.Value == false then
            if key == "g" then
                script.Wait.Value = true
                for i = 1, 2 do
                    for i = 1, 12 do
                        RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0.16)
                        RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                        Run.Stepped:wait(0.01)
                    end
                    for i = 1, 12 do
                        RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                        RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, -0.16)
                        Run.Stepped:wait(0.005)
                    end
                end
                for i = 1, 12 do
                    RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                    RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                    Run.Stepped:wait(0.005)
                end
                game:getService("Chat"):Chat(Player.Character.Head, "FrostBolt!")
                local p = Instance.new("Part", Workspace)
                p.Color = Color3.new(0, 0, 210)
                p.Transparency = 0.5
                p.Size = Vector3.new(3, 3, 3)
                p.TopSurface = "Smooth"
                p.BottomSurface = "Smooth"
                p.CanCollide = false
                p.Shape = "Ball"
                s = script.FD2:Clone()
                s.Parent = p
                s.Disabled = false
                p.CFrame = Player.Character.Torso.CFrame*CFrame.new(0, 0, -12)
                y = Instance.new("BodyVelocity", p)
                y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
                y.velocity = Player.Character.Torso.CFrame.lookVector*80
                local f = Instance.new("Fire", p)
                f.Color = Color3.new(0, 0, 255)
                wait(6)
                game.Debris:addItem(p, 1)
                script.Wait.Value = false
            end
        else print'waiting'
        end
    end)
end


if Player.spell4.Value == false then
    print'hi' 
else
    Mouse.KeyDown:connect(function(key)
        if script.Wait.Value == false then
            if key == "b" then
                script.Wait.Value = true
                for i = 1, 2 do
                    for i = 1, 12 do
                        RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0.16)
                        RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                        Run.Stepped:wait(0.01)
                    end
                    for i = 1, 12 do
                        RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                        RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, -0.16)
                        Run.Stepped:wait(0.005)
                    end
                end
                for i = 1, 12 do
                    RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                    RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
                    Run.Stepped:wait(0.005)
                end
                game:getService("Chat"):Chat(Player.Character.Head, "UnholyBolt!")
                local p = Instance.new("Part", Workspace)
                p.Color = Color3.new(0, 210, 0)
                p.Transparency = 0.5
                p.Size = Vector3.new(3, 3, 3)
                p.TopSurface = "Smooth"
                p.BottomSurface = "Smooth"
                p.CanCollide = false
                p.Shape = "Ball"
                s = script.FD3:Clone()
                s.Parent = p
                s.Disabled = false
                p.CFrame = Player.Character.Torso.CFrame*CFrame.new(0, 0, -12)
                y = Instance.new("BodyVelocity", p)
                y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
                y.velocity = Player.Character.Torso.CFrame.lookVector*80
                local f = Instance.new("Fire", p)
                f.Color = Color3.new(0, 255, 0)
                wait(6)
                game.Debris:addItem(p, 1)
                script.Wait.Value = false
            end
        else print'waiting'
        end
    end)
end

1
there is still an error now on line 190 Prioxis 673 — 10y
0
Like I said, there are a lot of errors throughout because of ends missing and in the wrong places, would you like me to correct them all for you? BlackJPI 2658 — 10y
1
yes please Prioxis 673 — 10y
0
Check the edit. BlackJPI 2658 — 10y
Ad

Answer this question