Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

2 comments

0

tell us what the output says

0

Players.TeshowyPL.PlayerGui.intermission.TextLabel.TimeText:33: Expected 'end' (to close 'function' at line 25), got 'else'

2 answers

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.

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

This discussion is preserved as it was. New answers, comments, and votes are closed.