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

What's Wrong With My Script? [Unanswered]

Asked by 9 years ago

The Output said Workspace.Load/End:33: ')' expected (to close '(' at line 6) near 'end' and attempt to call a nil value Here is the script I made:

Trainers = {"CjGamer1454", "Player"}

game.Players.PlayerAdded:connect(function(nP)
    for _,v in pairs(Trainers) do
    if nP.Name == v then
        nP.Chatted:connect(function(msg)

            if msg == "cpu start SwordFighting" then

                if game.Lighting:FindFirstChild("SwordFighting") then
                    game.Lighting.SwordFighting.Parent = game.Workspace
                    m = Instance.new("Message",workspace)
                    m.Text = "Starting SwordFighting"
                    for i = 1,10 do
                        wait(.1)
                        m.Text = i
                    end
                    wait(1)
                    m.Text = ""
                    wait(3)
                    m:Destroy()

                elseif msg == "cpu end" then

                    if game.Workspace:FindFirstChild("SwordFighting") then
                        game.Workspace.SwordFighting.Parent = game.Lighting

                    end

                    end
                end
            end
        end)
    end
end

0
You didn't properly indent and that made you miss an end aswell. PiggyJingles 358 — 9y
0
Ok I will ceck CjGamer1454 0 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

You need to enclose parenthesis when creating functions inline like that.

Trainers = {"CjGamer1454", "Player"}

game.Players.PlayerAdded:connect(function(nP)
...
end)

Edit: You did not properly indent and are missing an end as well.

0
Did not fix the problem. CjGamer1454 0 — 9y
Ad

Answer this question