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

why else has an error and why end got an error pls help?

Asked by 2 years ago
local CocaColaobby = game.Workspace:WaitForChild('Coca cola Obby')

while wait() do

while wait() do
    script.Parent.Text = "Intermission: "..game.ServerStorage.Time.Value
    if game.ServerStorage.Time.Value <= 0 then
        break
    end
end

if game.ServerStorage.Time.Value <= 0 then
    script.Parent.Text = "Choosing Soda Party..."
    wait(2)
    script.Parent.Text = "Soda Party has been Choosed!"
    wait(2)
    local m = math.random(1,3)
    if m == 1 then
        script.Parent.Text = "Coca cola Obby"
        wait(2)
        script.Parent.Text = "Be a winner in the Coca cola Obby!"
        for _, Child in pairs(CocaColaobby:GetChildren()) do
            Child.Transparency = 0
            Child.CanCollide = true
            workspace["Coca cola Obby"]["Winner pad"].Touched:Connect(function()

                    Child.Transparency = 1
                    Child.CanCollide = false
                    script.Parent.Text = "Someone Won!"

                wait(2) 

    else--error if m == 2 then
            script.Parent.Text = "Fanta Obby"
            wait(2)
            script.Parent.Text = "Be a winner in the Coca cola Obby!"
            for _, Child in pairs(CocaColaobby:GetChildren()) do
                Child.Transparency = 0
                Child.CanCollide = true
                workspace["Coca cola Obby"]["Winner pad"].Touched:Connect(function()

                        Child.Transparency = 1
                        Child.CanCollide = false
                        script.Parent.Text = "Someone Won!"
wait(2)

        else --error if m == 3 then
                script.Parent.Text = "Sprite Obby"
                wait(2)
                script.Parent.Text = "Be a winner in the Coca cola Obby!"
                for _, Child in pairs(CocaColaobby:GetChildren()) do
                    Child.Transparency = 0
                    Child.CanCollide = true
                    workspace["Coca cola Obby"]["Winner pad"].Touched:Connect(function()                    
                            Child.Transparency = 1
                            Child.CanCollide = false
                            script.Parent.Text = "Someone Won!"

wait(2)

                                                    end
                                                end -- error
                                            end
                                        end
                                        end

    end
end
0
tell us what the output says sne_123456 439 — 2y
0
Players.TeshowyPL.PlayerGui.intermission.TextLabel.TimeText:33: Expected 'end' (to close 'function' at line 25), got 'else' teshowypl 15 — 2y

2 answers

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

You never put and end to any of the Touched functions and for loops. Remove the code on line 3. Then see if it works.

Edit: Oh and that means almost all of the ends at the end of the script are not in the right place.

Ad
Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

I beg of you to 1st learn the basics of scripting before coming to us with a huge piece of code with hundreds of errors, anyways it took my a while heres a new script that actually closes your function...

local CocaColaobby = game.Workspace:WaitForChild('Coca cola Obby')


while wait() do
    script.Parent.Text = "Intermission: "..game.ServerStorage.Time.Value
    if game.ServerStorage.Time.Value <= 0 then
        break
    end
end

if game.ServerStorage.Time.Value <= 0 then
    script.Parent.Text = "Choosing Soda Party..."
    wait(2)
    script.Parent.Text = "Soda Party has been Choosed!"
    wait(2)
    local m = math.random(1,3)
    if m == 1 then
        script.Parent.Text = "Coca cola Obby"
        wait(2)
        script.Parent.Text = "Be a winner in the Coca cola Obby!"
        for _, Child in pairs(CocaColaobby:GetChildren()) do
            Child.Transparency = 0
            Child.CanCollide = true
            workspace["Coca cola Obby"]["Winner pad"].Touched:Connect(function()

                    Child.Transparency = 1
                    Child.CanCollide = false
                    script.Parent.Text = "Someone Won!"

                wait(2) 
    end
end

    else if m == 2 then
            script.Parent.Text = "Fanta Obby"
            wait(2)
            script.Parent.Text = "Be a winner in the Coca cola Obby!"
            for _, Child in pairs(CocaColaobby:GetChildren()) do
                Child.Transparency = 0
                Child.CanCollide = true
                workspace["Coca cola Obby"]["Winner pad"].Touched:Connect(function()

                        Child.Transparency = 1
                        Child.CanCollide = false
                        script.Parent.Text = "Someone Won!"
        wait(2)
    end
end
        else  if m == 3 then
                script.Parent.Text = "Sprite Obby"
                wait(2)
                script.Parent.Text = "Be a winner in the Coca cola Obby!"
                for _, Child in pairs(CocaColaobby:GetChildren()) do
                    Child.Transparency = 0
                    Child.CanCollide = true
                    workspace["Coca cola Obby"]["Winner pad"].Touched:Connect(function()                    
                            Child.Transparency = 1
                            Child.CanCollide = false
                            script.Parent.Text = "Someone Won!"

        wait(2)

    end
end
end

by the way it seems that you are trying to randomly pick obbies, but in all the functions you seem to only pick the winner pad in the coca cola obby only, please 1. learn how to script and 2. actually know what you are scripting

Answer this question