Ok so my code is for a game called shape blitz which I’ll release soon. This game is set up in stages. Every stage will increase the difficulty as seen in my functions. The goal of the game is to tap on the squares and don’t touch the circles. This game is kind of like fruit ninja except you can’t let the squares fall either or you lose. This is the core code of the game and its placed under starterGUI. Can anyone help me shorten it without causing bugs?
local player = game.Players.LocalPlayer
local GAME = player.PlayerGui.Game
local lost = player.Lost
local fell = game.ReplicatedStorage.SquareFell
local wait1 = 1
local wait2 = 0.7
local wait3 = 0.6
local wait4 = 0.4
local wait5 = 0.2
local wait6 = 0.3
local stage = 0
local gamestarted = player:FindFirstChild("GameGoing")
local STAGE = player:FindFirstChild("Stage")
local scriptcheck = false
local function createSquare()
game.Workspace.SoundFX.SquareSpawn:Stop()
if player.Lost.Value ~= true then
local s = math.random(1,6)
if s == 1 then
local square = GAME.Square:Clone()
square.Position = GAME.t1.Position
square.Visible = true
square.Parent = GAME
local finalpos1 = UDim2.new(0.02, 0,0.78, 0)
local tweeninfo = TweenInfo.new(1.5,Enum.EasingStyle.Linear)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(square, TweenInfo.new(1.5), {Position = UDim2.new(square.Position.X.Scale, square.Position.X.Offset, square.Position.Y.Scale - 0.5, square.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(square, tweeninfo, {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
if square.Parent == GAME and lost.Value ~= true then
fell:FireServer()
square:Destroy()
player.Lost.Value = true
gamestarted.Value = false
game.Workspace.SoundFX.Lose:Play()
game.Workspace.SoundFX.Uptown:Stop()
game.Workspace.SoundFX.Normal:Stop()
game.Workspace.SoundFX.Medium:Stop()
game.Workspace.SoundFX.Hard:Stop()
game.Workspace.SoundFX.Chaos:Stop()
return
end
elseif s == 2 then
local square = GAME.Square:Clone()
square.Position = GAME.t2.Position
square.Visible = true
square.Parent = GAME
local finalpos1 = UDim2.new(0.241, 0,0.78, 0)
local tweeninfo = TweenInfo.new(1.5,Enum.EasingStyle.Linear)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(square, TweenInfo.new(1.5), {Position = UDim2.new(square.Position.X.Scale, square.Position.X.Offset, square.Position.Y.Scale - 0.5, square.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(square, tweeninfo, {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
if square.Parent == GAME and lost.Value ~= true then
fell:FireServer()
square:Destroy()
player.Lost.Value = true
gamestarted.Value = false
game.Workspace.SoundFX.Lose:Play()
game.Workspace.SoundFX.Uptown:Stop()
game.Workspace.SoundFX.Normal:Stop()
game.Workspace.SoundFX.Medium:Stop()
game.Workspace.SoundFX.Hard:Stop()
game.Workspace.SoundFX.Chaos:Stop()
return
end
elseif s == 3 then
local square = GAME.Square:Clone()
square.Position = GAME.t3.Position
square.Visible = true
square.Parent = GAME
local finalpos1 = UDim2.new(0.461, 0,0.78, 0)
local tweeninfo = TweenInfo.new(1.5,Enum.EasingStyle.Linear)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(square, TweenInfo.new(1.5), {Position = UDim2.new(square.Position.X.Scale, square.Position.X.Offset, square.Position.Y.Scale - 0.5, square.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(square, tweeninfo, {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
if square.Parent == GAME and lost.Value ~= true then
fell:FireServer()
square:Destroy()
player.Lost.Value = true
gamestarted.Value = false
game.Workspace.SoundFX.Lose:Play()
game.Workspace.SoundFX.Uptown:Stop()
game.Workspace.SoundFX.Normal:Stop()
game.Workspace.SoundFX.Medium:Stop()
game.Workspace.SoundFX.Hard:Stop()
game.Workspace.SoundFX.Chaos:Stop()
return
end
elseif s == 4 then
local square = GAME.Square:Clone()
square.Position = GAME.t4.Position
square.Visible = true
square.Parent = GAME
local finalpos1 = UDim2.new(0.67, 0,0.78, 0)
local tweeninfo = TweenInfo.new(1.5,Enum.EasingStyle.Linear)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(square, TweenInfo.new(1.5), {Position = UDim2.new(square.Position.X.Scale, square.Position.X.Offset, square.Position.Y.Scale - 0.5, square.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(square, tweeninfo, {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
if square.Parent == GAME and lost.Value ~= true then
fell:FireServer()
square:Destroy()
player.Lost.Value = true
gamestarted.Value = false
game.Workspace.SoundFX.Lose:Play()
game.Workspace.SoundFX.Uptown:Stop()
game.Workspace.SoundFX.Normal:Stop()
game.Workspace.SoundFX.Medium:Stop()
game.Workspace.SoundFX.Hard:Stop()
game.Workspace.SoundFX.Chaos:Stop()
return
end
elseif s == 5 then
local square = GAME.Square:Clone()
square.Position = GAME.t5.Position
square.Visible = true
square.Parent = GAME
local finalpos1 = UDim2.new(0.909, 0,0.78, 0)
local tweeninfo = TweenInfo.new(1.5,Enum.EasingStyle.Linear)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(square, TweenInfo.new(1.5), {Position = UDim2.new(square.Position.X.Scale, square.Position.X.Offset, square.Position.Y.Scale - 0.5, square.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(square, tweeninfo, {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
if square.Parent == GAME and lost.Value ~= true then
fell:FireServer()
square:Destroy()
player.Lost.Value = true
gamestarted.Value = false
game.Workspace.SoundFX.Lose:Play()
game.Workspace.SoundFX.Uptown:Stop()
game.Workspace.SoundFX.Normal:Stop()
game.Workspace.SoundFX.Medium:Stop()
game.Workspace.SoundFX.Hard:Stop()
game.Workspace.SoundFX.Chaos:Stop()
return
end
end
end
end
local function createSquarestage3()
game.Workspace.SoundFX.SquareSpawn:Stop()
if player.Lost.Value ~= true then
local s = math.random(1,6)
if s == 1 then
local square = GAME.Square:Clone()
square.Position = GAME.t1.Position
square.Visible = true
square.Parent = GAME
local finalpos1 = UDim2.new(0.02, 0,0.78, 0)
local tweeninfo = TweenInfo.new(1.2,Enum.EasingStyle.Linear)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(square, TweenInfo.new(1.2), {Position = UDim2.new(square.Position.X.Scale, square.Position.X.Offset, square.Position.Y.Scale - 0.5, square.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(square, tweeninfo, {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
if square.Parent == GAME and lost.Value ~= true then
fell:FireServer()
square:Destroy()
player.Lost.Value = true
gamestarted.Value = false
game.Workspace.SoundFX.Lose:Play()
game.Workspace.SoundFX.Uptown:Stop()
game.Workspace.SoundFX.Medium:Stop()
game.Workspace.SoundFX.Normal:Stop()
game.Workspace.SoundFX.Hard:Stop()
game.Workspace.SoundFX.Chaos:Stop()
return
end
elseif s == 2 then
local square = GAME.Square:Clone()
square.Position = GAME.t2.Position
square.Visible = true
square.Parent = GAME
local finalpos1 = UDim2.new(0.241, 0,0.78, 0)
local tweeninfo = TweenInfo.new(1.2,Enum.EasingStyle.Linear)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(square, TweenInfo.new(1.2), {Position = UDim2.new(square.Position.X.Scale, square.Position.X.Offset, square.Position.Y.Scale - 0.5, square.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(square, tweeninfo, {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
if square.Parent == GAME and lost.Value ~= true then
fell:FireServer()
square:Destroy()
player.Lost.Value = true
gamestarted.Value = false
game.Workspace.SoundFX.Lose:Play()
game.Workspace.SoundFX.Uptown:Stop()
game.Workspace.SoundFX.Medium:Stop()
game.Workspace.SoundFX.Normal:Stop()
game.Workspace.SoundFX.Hard:Stop()
game.Workspace.SoundFX.Chaos:Stop()
return
end
elseif s == 3 then
local square = GAME.Square:Clone()
square.Position = GAME.t3.Position
square.Visible = true
square.Parent = GAME
local finalpos1 = UDim2.new(0.461, 0,0.78, 0)
local tweeninfo = TweenInfo.new(1.2,Enum.EasingStyle.Linear)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(square, TweenInfo.new(1.2), {Position = UDim2.new(square.Position.X.Scale, square.Position.X.Offset, square.Position.Y.Scale - 0.5, square.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(square, tweeninfo, {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
if square.Parent == GAME and lost.Value ~= true then
fell:FireServer()
square:Destroy()
player.Lost.Value = true
gamestarted.Value = false
game.Workspace.SoundFX.Lose:Play()
game.Workspace.SoundFX.Uptown:Stop()
game.Workspace.SoundFX.Medium:Stop()
game.Workspace.SoundFX.Normal:Stop()
game.Workspace.SoundFX.Hard:Stop()
game.Workspace.SoundFX.Chaos:Stop()
return
end
elseif s == 4 then
local square = GAME.Square:Clone()
square.Position = GAME.t4.Position
square.Visible = true
square.Parent = GAME
local finalpos1 = UDim2.new(0.67, 0,0.78, 0)
local tweeninfo = TweenInfo.new(1.2,Enum.EasingStyle.Linear)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(square, TweenInfo.new(1.2), {Position = UDim2.new(square.Position.X.Scale, square.Position.X.Offset, square.Position.Y.Scale - 0.5, square.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(square, tweeninfo, {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
if square.Parent == GAME and lost.Value ~= true then
fell:FireServer()
square:Destroy()
player.Lost.Value = true
gamestarted.Value = false
game.Workspace.SoundFX.Lose:Play()
game.Workspace.SoundFX.Uptown:Stop()
game.Workspace.SoundFX.Medium:Stop()
game.Workspace.SoundFX.Normal:Stop()
game.Workspace.SoundFX.Hard:Stop()
game.Workspace.SoundFX.Chaos:Stop()
return
end
elseif s == 5 then
local square = GAME.Square:Clone()
square.Position = GAME.t5.Position
square.Visible = true
square.Parent = GAME
local finalpos1 = UDim2.new(0.909, 0,0.78, 0)
local tweeninfo = TweenInfo.new(1.5,Enum.EasingStyle.Linear)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(square, TweenInfo.new(1), {Position = UDim2.new(square.Position.X.Scale, square.Position.X.Offset, square.Position.Y.Scale - 0.5, square.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(square, tweeninfo, {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
if square.Parent == GAME and lost.Value ~= true then
fell:FireServer()
square:Destroy()
player.Lost.Value = true
gamestarted.Value = false
game.Workspace.SoundFX.Lose:Play()
game.Workspace.SoundFX.Uptown:Stop()
game.Workspace.SoundFX.Medium:Stop()
game.Workspace.SoundFX.Normal:Stop()
game.Workspace.SoundFX.Hard:Stop()
game.Workspace.SoundFX.Chaos:Stop()
return
end
end
end
end
local function createSquarestage5()
game.Workspace.SoundFX.SquareSpawn:Stop()
if player.Lost.Value ~= true then
local s = math.random(1,6)
if s == 1 then
local square = GAME.Square:Clone()
square.Position = GAME.t1.Position
square.Visible = true
square.Parent = GAME
local finalpos1 = UDim2.new(0.02, 0,0.78, 0)
local tweeninfo = TweenInfo.new(1,Enum.EasingStyle.Linear)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(square, TweenInfo.new(1), {Position = UDim2.new(square.Position.X.Scale, square.Position.X.Offset, square.Position.Y.Scale - 0.5, square.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(square, tweeninfo, {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
if square.Parent == GAME and lost.Value ~= true then
fell:FireServer()
square:Destroy()
player.Lost.Value = true
gamestarted.Value = false
game.Workspace.SoundFX.Lose:Play()
game.Workspace.SoundFX.Uptown:Stop()
game.Workspace.SoundFX.Medium:Stop()
game.Workspace.SoundFX.Normal:Stop()
game.Workspace.SoundFX.Hard:Stop()
game.Workspace.SoundFX.Chaos:Stop()
return
end
elseif s == 2 then
local square = GAME.Square:Clone()
square.Position = GAME.t2.Position
square.Visible = true
square.Parent = GAME
local finalpos1 = UDim2.new(0.241, 0,0.78, 0)
local tweeninfo = TweenInfo.new(1,Enum.EasingStyle.Linear)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(square, TweenInfo.new(1), {Position = UDim2.new(square.Position.X.Scale, square.Position.X.Offset, square.Position.Y.Scale - 0.5, square.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(square, tweeninfo, {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
if square.Parent == GAME and lost.Value ~= true then
fell:FireServer()
square:Destroy()
player.Lost.Value = true
gamestarted.Value = false
game.Workspace.SoundFX.Lose:Play()
game.Workspace.SoundFX.Uptown:Stop()
game.Workspace.SoundFX.Medium:Stop()
game.Workspace.SoundFX.Normal:Stop()
game.Workspace.SoundFX.Hard:Stop()
game.Workspace.SoundFX.Chaos:Stop()
return
end
elseif s == 3 then
local square = GAME.Square:Clone()
square.Position = GAME.t3.Position
square.Visible = true
square.Parent = GAME
local finalpos1 = UDim2.new(0.461, 0,0.78, 0)
local tweeninfo = TweenInfo.new(1,Enum.EasingStyle.Linear)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(square, TweenInfo.new(1), {Position = UDim2.new(square.Position.X.Scale, square.Position.X.Offset, square.Position.Y.Scale - 0.5, square.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(square, tweeninfo, {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
if square.Parent == GAME and lost.Value ~= true then
fell:FireServer()
square:Destroy()
player.Lost.Value = true
gamestarted.Value = false
game.Workspace.SoundFX.Lose:Play()
game.Workspace.SoundFX.Uptown:Stop()
game.Workspace.SoundFX.Medium:Stop()
game.Workspace.SoundFX.Normal:Stop()
game.Workspace.SoundFX.Hard:Stop()
game.Workspace.SoundFX.Chaos:Stop()
return
end
elseif s == 4 then
local square = GAME.Square:Clone()
square.Position = GAME.t4.Position
square.Visible = true
square.Parent = GAME
local finalpos1 = UDim2.new(0.67, 0,0.78, 0)
local tweeninfo = TweenInfo.new(1,Enum.EasingStyle.Linear)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(square, TweenInfo.new(1), {Position = UDim2.new(square.Position.X.Scale, square.Position.X.Offset, square.Position.Y.Scale - 0.5, square.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(square, tweeninfo, {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
if square.Parent == GAME and lost.Value ~= true then
fell:FireServer()
square:Destroy()
player.Lost.Value = true
gamestarted.Value = false
game.Workspace.SoundFX.Lose:Play()
game.Workspace.SoundFX.Uptown:Stop()
game.Workspace.SoundFX.Medium:Stop()
game.Workspace.SoundFX.Normal:Stop()
game.Workspace.SoundFX.Hard:Stop()
game.Workspace.SoundFX.Chaos:Stop()
return
end
elseif s == 5 then
local square = GAME.Square:Clone()
square.Position = GAME.t5.Position
square.Visible = true
square.Parent = GAME
local finalpos1 = UDim2.new(0.909, 0,0.78, 0)
local tweeninfo = TweenInfo.new(1,Enum.EasingStyle.Linear)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(square, TweenInfo.new(1), {Position = UDim2.new(square.Position.X.Scale, square.Position.X.Offset, square.Position.Y.Scale - 0.5, square.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(square, tweeninfo, {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
if square.Parent == GAME and lost.Value ~= true then
fell:FireServer()
square:Destroy()
player.Lost.Value = true
gamestarted.Value = false
game.Workspace.SoundFX.Lose:Play()
game.Workspace.SoundFX.Uptown:Stop()
game.Workspace.SoundFX.Medium:Stop()
game.Workspace.SoundFX.Normal:Stop()
game.Workspace.SoundFX.Hard:Stop()
game.Workspace.SoundFX.Chaos:Stop()
return
end
end
end
end
local function createCircle()
if player.Lost.Value ~= true then
local s = math.random(1,6)
if s == 1 then
local circle = GAME.Circle:Clone()
circle.Position = GAME.t1.Position
circle.Visible = true
circle.Parent = GAME
local finalpos1 = UDim2.new(0.02, 0,0.78, 0)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.5), {Position = UDim2.new(circle.Position.X.Scale, circle.Position.X.Offset, circle.Position.Y.Scale - 0.5, circle.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.5), {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
circle:Destroy()
elseif s == 2 then
local circle = GAME.Circle:Clone()
circle.Visible = true
circle.Parent = GAME
circle.Position = GAME.t2.Position
local finalpos1 = UDim2.new(0.241, 0,0.78, 0)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.5), {Position = UDim2.new(circle.Position.X.Scale, circle.Position.X.Offset, circle.Position.Y.Scale - 0.5, circle.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.5), {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
circle:Destroy()
elseif s == 3 then
local circle = GAME.Circle:Clone()
circle.Visible = true
circle.Parent = GAME
circle.Position = GAME.t3.Position
local finalpos1 = UDim2.new(0.461, 0,0.78, 0)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.5), {Position = UDim2.new(circle.Position.X.Scale, circle.Position.X.Offset, circle.Position.Y.Scale - 0.5, circle.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.5), {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
circle:Destroy()
elseif s == 4 then
local circle = GAME.Circle:Clone()
circle.Visible = true
circle.Parent = GAME
circle.Position = GAME.t4.Position
local finalpos1 = UDim2.new(0.67, 0,0.78, 0)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.5), {Position = UDim2.new(circle.Position.X.Scale, circle.Position.X.Offset, circle.Position.Y.Scale - 0.5, circle.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.5), {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
circle:Destroy()
elseif s == 5 then
local circle = GAME.Circle:Clone()
circle.Visible = true
circle.Parent = GAME
circle.Position = GAME.t5.Position
local finalpos1 = UDim2.new(0.909, 0,0.78, 0)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.5), {Position = UDim2.new(circle.Position.X.Scale, circle.Position.X.Offset, circle.Position.Y.Scale - 0.5, circle.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.5), {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
circle:Destroy()
end
end
end
local function createCirclestage3()
if player.Lost.Value ~= true then
local s = math.random(1,6)
if s == 1 then
local circle = GAME.Circle:Clone()
circle.Position = GAME.t1.Position
circle.Visible = true
circle.Parent = GAME
local finalpos1 = UDim2.new(0.02, 0,0.78, 0)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.2), {Position = UDim2.new(circle.Position.X.Scale, circle.Position.X.Offset, circle.Position.Y.Scale - 0.5, circle.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.2), {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
circle:Destroy()
elseif s == 2 then
local circle = GAME.Circle:Clone()
circle.Visible = true
circle.Parent = GAME
circle.Position = GAME.t2.Position
local finalpos1 = UDim2.new(0.241, 0,0.78, 0)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.2), {Position = UDim2.new(circle.Position.X.Scale, circle.Position.X.Offset, circle.Position.Y.Scale - 0.5, circle.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.2), {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
circle:Destroy()
elseif s == 3 then
local circle = GAME.Circle:Clone()
circle.Visible = true
circle.Parent = GAME
circle.Position = GAME.t3.Position
local finalpos1 = UDim2.new(0.461, 0,0.78, 0)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.2), {Position = UDim2.new(circle.Position.X.Scale, circle.Position.X.Offset, circle.Position.Y.Scale - 0.5, circle.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.2), {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
circle:Destroy()
elseif s == 4 then
local circle = GAME.Circle:Clone()
circle.Visible = true
circle.Parent = GAME
circle.Position = GAME.t4.Position
local finalpos1 = UDim2.new(0.67, 0,0.78, 0)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.2), {Position = UDim2.new(circle.Position.X.Scale, circle.Position.X.Offset, circle.Position.Y.Scale - 0.5, circle.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.2), {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
circle:Destroy()
elseif s == 5 then
local circle = GAME.Circle:Clone()
circle.Visible = true
circle.Parent = GAME
circle.Position = GAME.t5.Position
local finalpos1 = UDim2.new(0.909, 0,0.78, 0)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.2), {Position = UDim2.new(circle.Position.X.Scale, circle.Position.X.Offset, circle.Position.Y.Scale - 0.5, circle.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(circle, TweenInfo.new(1.2), {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
circle:Destroy()
end
end
end
local function createCirclestage5()
if player.Lost.Value ~= true then
local s = math.random(1,6)
if s == 1 then
local circle = GAME.Circle:Clone()
circle.Position = GAME.t1.Position
circle.Visible = true
circle.Parent = GAME
local finalpos1 = UDim2.new(0.02, 0,0.78, 0)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(circle, TweenInfo.new(1), {Position = UDim2.new(circle.Position.X.Scale, circle.Position.X.Offset, circle.Position.Y.Scale - 0.5, circle.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(circle, TweenInfo.new(1), {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
circle:Destroy()
elseif s == 2 then
local circle = GAME.Circle:Clone()
circle.Visible = true
circle.Parent = GAME
circle.Position = GAME.t2.Position
local finalpos1 = UDim2.new(0.241, 0,0.78, 0)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(circle, TweenInfo.new(1), {Position = UDim2.new(circle.Position.X.Scale, circle.Position.X.Offset, circle.Position.Y.Scale - 0.5, circle.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(circle, TweenInfo.new(1), {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
circle:Destroy()
elseif s == 3 then
local circle = GAME.Circle:Clone()
circle.Visible = true
circle.Parent = GAME
circle.Position = GAME.t3.Position
local finalpos1 = UDim2.new(0.461, 0,0.78, 0)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(circle, TweenInfo.new(1), {Position = UDim2.new(circle.Position.X.Scale, circle.Position.X.Offset, circle.Position.Y.Scale - 0.5, circle.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(circle, TweenInfo.new(1), {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
circle:Destroy()
elseif s == 4 then
local circle = GAME.Circle:Clone()
circle.Visible = true
circle.Parent = GAME
circle.Position = GAME.t4.Position
local finalpos1 = UDim2.new(0.67, 0,0.78, 0)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(circle, TweenInfo.new(1), {Position = UDim2.new(circle.Position.X.Scale, circle.Position.X.Offset, circle.Position.Y.Scale - 0.5, circle.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(circle, TweenInfo.new(1), {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
circle:Destroy()
elseif s == 5 then
local circle = GAME.Circle:Clone()
circle.Visible = true
circle.Parent = GAME
circle.Position = GAME.t5.Position
local finalpos1 = UDim2.new(0.909, 0,0.78, 0)
--make the square go up and down then self destruct
local tween = game:GetService("TweenService"):Create(circle, TweenInfo.new(1), {Position = UDim2.new(circle.Position.X.Scale, circle.Position.X.Offset, circle.Position.Y.Scale - 0.5, circle.Position.Y.Offset)})
local tween2 = game:GetService("TweenService"):Create(circle, TweenInfo.new(1), {Position = finalpos1})
tween:Play()
wait(1)
tween2:Play()
wait(1)
circle:Destroy()
end
end
end
local function chooseShapestage1()
local lost = player.Lost
if lost.Value ~= true then
local shape = math.random(1,6)
print(shape)
if shape == 1 then
createSquare()
elseif shape == 2 then
createSquare()
elseif shape == 3 then
createSquare()
elseif shape == 4 then
createSquare()
elseif shape == 5 then
createSquare()
elseif shape == 6 then
createCircle()
end
end
end
local function chooseShapestage2()
local lost = player.Lost
if lost.Value ~= true then
local shape = math.random(1,6)
print(shape)
if shape == 3 then
createSquare()
elseif shape == 4 then
createSquare()
elseif shape == 5 then
createSquare()
elseif shape == 6 then
createSquare()
elseif shape == 1 then
createSquare()
elseif shape == 2 then
createCircle()
end
end
end
local function chooseShapestage3()
local lost = player.Lost
if lost.Value ~= true then
local shape = math.random(1,6)
print(shape)
if shape == 3 then
createSquarestage3()
elseif shape == 4 then
createSquarestage3()
elseif shape == 5 then
createSquarestage3()
elseif shape == 6 then
createSquarestage3()
elseif shape == 1 then
createSquarestage3()
elseif shape == 2 then
createCirclestage3()
end
end
end
local function chooseShapestage5()
local lost = player.Lost
if lost.Value ~= true then
local shape = math.random(1,6)
print(shape)
if shape == 3 then
createSquarestage5()
elseif shape == 4 then
createSquarestage5()
elseif shape == 5 then
createSquarestage5()
elseif shape == 6 then
createSquarestage5()
elseif shape == 1 then
createCirclestage5()
elseif shape == 2 then
createCirclestage5()
end
end
end
local function spawnTwoShapesstageThree()
local lost = player.Lost
if lost.Value ~= true then
local shape1 = math.random(1, 6)
local shape2 = math.random(1, 6)
print("Spawning Shapes in Stage Three")
local function spawnShape(shapeType)
if shapeType == 3 then
createSquarestage3()
elseif shapeType == 4 then
createSquarestage3()
elseif shapeType == 5 then
createSquarestage3()
elseif shapeType == 6 then
createSquarestage3()
elseif shapeType == 1 then
createSquarestage3()
elseif shapeType == 2 then
createCirclestage3()
end
end
-- Use a coroutine to spawn two shapes simultaneously
local function spawnTwoShapes()
spawnShape(shape1)
wait(0.1) -- Adjust the delay as needed to control the timing
spawnShape(shape2)
end
coroutine.wrap(spawnTwoShapes)()
end
end
local function spawnThreeShapesstageFive()
local lost = player.Lost
if lost.Value ~= true then
local shape1 = math.random(1, 6)
local shape2 = math.random(1, 6)
local shape3 = math.random(1,6)
print("Spawning Shapes in Stage Three")
local function spawnShape(shapeType)
if shapeType == 3 then
createSquarestage3()
elseif shapeType == 4 then
createSquarestage3()
elseif shapeType == 5 then
createSquarestage3()
elseif shapeType == 6 then
createSquarestage3()
elseif shapeType == 1 then
createSquarestage3()
elseif shapeType == 2 then
createCirclestage3()
end
end
-- Use a coroutine to spawn two shapes simultaneously
local function spawnTwoShapesstage5()
spawnShape(shape1)
wait(0.1) -- Adjust the delay as needed to control the timing
spawnShape(shape2)
wait(0.1)
spawnShape(shape3)
end
coroutine.wrap(spawnTwoShapesstage5)()
end
end
local gg = player.GameGoing
local function stageOne()
STAGE.Value = "Easy"
stage = 1
wait(0.1)
if gg.Value == true then
chooseShapestage1()
elseif gg.Value == false then
return
end
wait(wait1)
gg.Value = true
if gg.Value == true then
print("Spaqn")
chooseShapestage1()
elseif gg.Value == false then
stage = 0
return
end
wait(wait1)
gg.Value = true
if gg.Value == true then
chooseShapestage1()
elseif gg.Value == false then
stage = 0
return
end
wait(wait1)
gg.Value = true
if gg.Value == true then
chooseShapestage1()
elseif gg.Value == false then
stage = 0
return
end
wait(wait1)
gg.Value = true
if gg.Value == true then
chooseShapestage1()
elseif gg.Value == false then
stage = 0
return
end
wait(wait1)
gg.Value = true
if gg.Value == true then
chooseShapestage1()
elseif gg.Value == false then
stage = 0
return
end
wait(wait1)
gg.Value = true
if gg.Value == true then
chooseShapestage1()
elseif gg.Value == false then
stage = 0
return
end
wait(wait1)
gg.Value = true
if gg.Value == true then
chooseShapestage1()
elseif gg.Value == false then
stage = 0
return
end
wait(wait1)
gg.Value = true
if gg.Value == true then
chooseShapestage1()
elseif gg.Value == false then
stage = 0
return
end
wait(wait1)
gg.Value = true
if gg.Value == true then
chooseShapestage1()
elseif gg.Value == false then
stage = 0
return
end
wait(wait1)
gg.Value = true
if gg.Value == true then
chooseShapestage1()
elseif gg.Value == false then
stage = 0
return
end
wait(wait1)
gg.Value = true
if gg.Value == true then
chooseShapestage1()
elseif gg.Value == false then
stage = 0
return
end
wait(wait1)
game.Workspace.SoundFX.Uptown:Stop()
wait1 = 1
end
local function stageTwo()
STAGE.Value = "Normal"
stage = 2
game.Workspace.SoundFX.Normal:Play()
if gg.Value == true then
chooseShapestage2()
elseif gg.Value == false then
stage = 0
STAGE.Value = "Easy"
return
end
wait(wait2)
if gg.Value == true then
chooseShapestage2()
elseif gg.Value == false then
stage = 0
STAGE.Value = "Easy"
return
end
wait(wait2)
if gg.Value == true then
chooseShapestage2()
elseif gg.Value == false then
stage = 0
STAGE.Value = "Easy"
return
end
wait(wait2)
if gg.Value == true then
chooseShapestage2()
elseif gg.Value == false then
stage = 0
STAGE.Value = "Easy"
return
end
wait(wait2)
if gg.Value == true then
chooseShapestage2()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait2)
if gg.Value == true then
chooseShapestage2()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait2)
if gg.Value == true then
chooseShapestage2()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait2)
if gg.Value == true then
chooseShapestage2()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait2)
if gg.Value == true then
chooseShapestage2()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait2)
if gg.Value == true then
chooseShapestage2()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait2)
if gg.Value == true then
chooseShapestage2()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait2)
if gg.Value == true then
chooseShapestage2()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait2)
if gg.Value == true then
chooseShapestage2()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait2)
if gg.Value == true then
chooseShapestage2()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait2)
wait2 = 0.7
game.Workspace.SoundFX.Normal:Stop()
end
local function stageThree()
STAGE.Value = "Medium"
game.Workspace.SoundFX.Medium:Play()
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait3)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait3)
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait3)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait3)
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait3)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait3)
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait3)
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait3)
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait3)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait3)
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait3)
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait3)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait3)
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait3)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait3)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait3)
stage = 3
game.Workspace.SoundFX.Medium:Stop()
end
local function stageFour()
STAGE.Value = "Hard"
game.Workspace.SoundFX.Hard:Play()
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
chooseShapestage3()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait4)
stage = 4
game.Workspace.SoundFX.Hard:Stop()
end
local function stageFive()
STAGE.Value = "Chaos"
game.Workspace.SoundFX.Chaos:Play()
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
chooseShapestage5()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnThreeShapesstageFive()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
chooseShapestage5()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
chooseShapestage5()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
chooseShapestage5()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
chooseShapestage5()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
chooseShapestage5()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnThreeShapesstageFive()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnThreeShapesstageFive()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
chooseShapestage5()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnThreeShapesstageFive()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnThreeShapesstageFive()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
chooseShapestage5()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnThreeShapesstageFive()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnThreeShapesstageFive()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
chooseShapestage5()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnThreeShapesstageFive()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnThreeShapesstageFive()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
if gg.Value == true then
spawnTwoShapesstageThree()
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
return
end
wait(wait5)
stage = 5
end
local function infiniteChaos()
STAGE.Value = "Infinite Chaos"
game.Workspace.SoundFX.Chaos:Stop()
game.Workspace.SoundFX.Chaos:Play()
game.Workspace.SoundFX.Chaos.PlaybackSpeed = 2
while true do
if gg.Value == true then
spawnThreeShapesstageFive()
wait(wait6)
elseif gg.Value == false then
STAGE.Value = "Easy"
stage = 0
break
end
end
end
local function GameStart()
if gg.Value == true and stage == 0 then
stageOne()
else
return
end
if gg.Value == true and stage == 1 then
stageTwo()
else
return
end
if gg.Value == true and stage == 2 then
stageThree()
else
return
end
if gg.Value == true and stage == 3 then
stageFour()
else
return
end
if gg.Value == true and stage == 4 then
stageFive()
else
return
end
if gg.Value == true and stage == 5 then
infiniteChaos()
else
return
end
end
game.ReplicatedStorage.G.OnClientEvent:Connect(function()
if scriptcheck == false then
wait(0.5)
scriptcheck = true
print("ClientFired")
gamestarted.Value = true
print("GameStarted")
GameStart()
wait(1)
scriptcheck = false
end
end)