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

Problem With My Script? [Repost]

Asked by 9 years ago

The output said Workspace.Script:29: ')' expected (to close '(' at line 6) near 'end' and attempt to call a nil value and here is my script

admin = {"CjGamer1454", "Player",}

game.Players.PlayerAdded:connect(function(nP)
    for _,v in pairs(admin) 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("Messafe",workspace)
                        m.Text = "Starting SwordFighting"
                        for i = 1,10 do
                            wait(0.1)
                            m.Text = 1
                            wait(1)
                            m.Text = ""
                            wait(3)
                            m:Destroy()
                            end

                    elseif msg == "cpu end" then
                        if game.Workspace:FindFirstChild("SwordFighting") then
                            game.Workspace.SwordFighting.Parent = game.Lighting
                        end

                        end
                        end
                    end
                end
            end)
        end
    end
end)

2 answers

Log in to vote
0
Answered by
Relatch 550 Moderation Voter
9 years ago

You have 2 extra ends, and you misspelled the word "message". Also, like PiggyJingles said, don't make another question.

admin = {"CjGamer1454", "Player",}

game.Players.PlayerAdded:connect(function(nP)
    for _,v in pairs(admin) 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
                        local m = Instance.new("Message",workspace)
                        m.Text = "Starting SwordFighting"
                        for i = 1,10 do
                            wait(0.1)
                            m.Text = 1
                            wait(1)
                            m.Text = ""
                            wait(3)
                            m:Destroy()
                        end
                    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
Sorry about that I just didn't understand the last one CjGamer1454 0 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

You have too many ends.

Please don't make another question when I was helping you on the other one.

Answer this question