Far too MANY lines of code

There are almost 1000 lines of code, omg
please find a way to simplify it

Code is here:

local char = Player.Character or Player.CharacterAdded:Wait()
local Time = Player:waitForChild("leaderstats").Time
local Colour1 = Player:waitForChild("leaderstats").Colour1
local Colour2 = Player:waitForChild("leaderstats").Colour2
local Floor1 = Player:waitForChild("leaderstats").Floor1
local Floor2 = Player:waitForChild("leaderstats").Floor2
local Win = Player:waitForChild("leaderstats").Win
local Set1 = game.Workspace["1"]
local Set2 = game.Workspace["2"]
local Set3 = game.Workspace["3"]
local Set4 = game.Workspace["4"]
local Set5 = game.Workspace["5"]
local Set1Floor1 = Set1:WaitForChild("Floor1")
local Set1Floor2 = Set1:WaitForChild("Floor2")
local Set1Floor3 = Set1:WaitForChild("Floor3")
local Set1Floor4 = Set1:WaitForChild("Floor4")
local Set1Floor5 = Set1:WaitForChild("Floor5")
local Set2Floor1 = Set2:WaitForChild("Floor1")
local Set2Floor2 = Set2:WaitForChild("Floor2")
local Set2Floor3 = Set2:WaitForChild("Floor3")
local Set2Floor4 = Set2:WaitForChild("Floor4")
local Set2Floor5 = Set2:WaitForChild("Floor5")
local Set3Floor1 = Set3:WaitForChild("Floor1")
local Set3Floor2 = Set3:WaitForChild("Floor2")
local Set3Floor3 = Set3:WaitForChild("Floor3")
local Set3Floor4 = Set3:WaitForChild("Floor4")
local Set3Floor5 = Set3:WaitForChild("Floor5")
local Set4Floor1 = Set4:WaitForChild("Floor1")
local Set4Floor2 = Set4:WaitForChild("Floor2")
local Set4Floor3 = Set4:WaitForChild("Floor3")
local Set4Floor4 = Set4:WaitForChild("Floor4")
local Set4Floor5 = Set4:WaitForChild("Floor5")
local Set5Floor1 = Set5:WaitForChild("Floor1")
local Set5Floor2 = Set5:WaitForChild("Floor2")
local Set5Floor3 = Set5:WaitForChild("Floor3")
local Set5Floor4 = Set5:WaitForChild("Floor4")
local Set5Floor5 = Set5:WaitForChild("Floor5")
local colour1 = Player.leaderstats:WaitForChild("Colour1")
local colour2 = Player.leaderstats:WaitForChild("Colour2")
local character = Player.Character or Player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local order = true

humanoid.Died:Connect(function()
	if Win.Value ~= "Yes" then
		Player.PlayerGui.ScreenGui.Lose.Visible = true
		Player.PlayerGui.ScreenGui.Win.Visible = false
		Colour1.Value = ""
		Colour2.Value = ""
		Floor1.Value = ""
		Floor2.Value = ""
		Time.Value = 0
		Set1Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set1Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set1Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set1Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set1Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set2Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set2Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set2Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set2Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set2Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set3Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set3Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set3Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set3Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set3Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set4Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set4Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set4Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set4Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set4Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set5Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set5Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set5Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set5Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
		Set5Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
		char.Archivable = true
		char:WaitForChild("HumanoidRootPart").Anchored = true
	end
end)


function changed()
	if Colour1.Value == Colour2.Value and Colour1.Value ~= "" and Colour2.Value ~= "" then
		Player.Character:WaitForChild("Humanoid").WalkSpeed = 0
		Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Climbing, false)
		Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Running, false)
		Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
		Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
		Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, false)
		Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
		Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Swimming, false)
		Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Flying, false)
		Player.PlayerGui.ScreenGui.Win.Visible = true
		Player.PlayerGui.ScreenGui.Win.TimeTaken.LocalScript.Enabled = true
		char.Archivable = true
		char:WaitForChild("HumanoidRootPart").Anchored = true
	end
end
colour1.Changed:Connect(changed)
colour2.Changed:Connect(changed)

Set1Floor1.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set1Floor1" then
			Set1Floor1.Color = Color3.new(0.333333, 0.333333, 1)
			Colour1.Value = "Blue"
			Floor1.Value = "Set1Floor1"
			wait(5)
			Set1Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set1Floor1" then
			Set1Floor1.Color = Color3.new(0.333333, 0.333333, 1)
			Colour2.Value = "Blue"
			Floor2.Value = "Set1Floor1"
			wait(5)
			Set1Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set1Floor1" and Floor2.Value ~= "Set1Floor1" then
			if order == true then
				Set1Floor1.Color = Color3.new(0.333333, 0.333333, 1)
				Colour1.Value = "Blue"
				Floor1.Value = "Set1Floor1"
				wait(5)
				Set1Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set1Floor1.Color = Color3.new(0.333333, 0.333333, 1)
				Colour2.Value = "Blue"
				Floor2.Value = "Set1Floor1"
				wait(5)
				Set1Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set1Floor2.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set1Floor2" then
			Set1Floor2.Color = Color3.new(1, 0, 0)
			Colour1.Value = "Red"
			Floor1.Value = "Set1Floor2"
			wait(5)
			Set1Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set1Floor2" then
			Set1Floor2.Color = Color3.new(1, 0, 0)
			Colour2.Value = "Red"
			Floor2.Value = "Set1Floor2"
			wait(5)
			Set1Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set1Floor2" and Floor2.Value ~= "Set1Floor2" then
			if order == true then
				Set1Floor2.Color = Color3.new(1, 0, 0)
				Colour1.Value = "Red"
				Floor1.Value = "Set1Floor2"
				wait(5)
				Set1Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set1Floor2.Color = Color3.new(1, 0, 0)
				Colour2.Value = "Red"
				Floor2.Value = "Set1Floor2"
				wait(5)
				Set1Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set1Floor3.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set1Floor3" then
			Set1Floor3.Color = Color3.new(0.666667, 1, 0)
			Colour1.Value = "Yellow"
			Floor1.Value = "Set1Floor3"
			wait(5)
			Set1Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set1Floor3" then
			Set1Floor3.Color = Color3.new(0.666667, 1, 0)
			Colour2.Value = "Yellow"
			Floor2.Value = "Set1Floor3"
			wait(5)
			Set1Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set1Floor3" and Floor2.Value ~= "Set1Floor3" then
			if order == true then
				Set1Floor3.Color = Color3.new(0.666667, 1, 0)
				Colour1.Value = "Yellow"
				Floor1.Value = "Set1Floor3"
				wait(5)
				Set1Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set1Floor3.Color = Color3.new(0.666667, 1, 0)
				Colour2.Value = "Yellow"
				Floor2.Value = "Set1Floor3"
				wait(5)
				Set1Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set1Floor4.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set1Floor4" then
			Set1Floor4.Color = Color3.new(1, 0, 0)
			Colour1.Value = "Red"
			Floor1.Value = "Set1Floor4"
			wait(5)
			Set1Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set1Floor4" then
			Set1Floor4.Color = Color3.new(1, 0, 0)
			Colour2.Value = "Red"
			Floor2.Value = "Set1Floor4"
			wait(5)
			Set1Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set1Floor4" and Floor2.Value ~= "Set1Floor4" then
			if order == true then
				Set1Floor4.Color = Color3.new(1, 0, 0)
				Colour1.Value = "Red"
				Floor1.Value = "Set1Floor4"
				wait(5)
				Set1Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set1Floor4.Color = Color3.new(1, 0, 0)
				Colour2.Value = "Red"
				Floor2.Value = "Set1Floor4"
				wait(5)
				Set1Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set1Floor5.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set1Floor5" then
			Set1Floor5.Color = Color3.new(0.333333, 0.333333, 1)
			Colour1.Value = "Blue"
			Floor1.Value = "Set1Floor5"
			wait(5)
			Set1Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set1Floor5" then
			Set1Floor5.Color = Color3.new(0.333333, 0.333333, 1)
			Colour2.Value = "Blue"
			Floor2.Value = "Set1Floor5"
			wait(5)
			Set1Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set1Floor5" and Floor2.Value ~= "Set1Floor5" then
			if order == true then
				Set1Floor5.Color = Color3.new(0.333333, 0.333333, 1)
				Colour1.Value = "Blue"
				Floor1.Value = "Set1Floor5"
				wait(5)
				Set1Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set1Floor5.Color = Color3.new(0.333333, 0.333333, 1)
				Colour2.Value = "Blue"
				Floor2.Value = "Set1Floor5"
				wait(5)
				Set1Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set2Floor1.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set2Floor1" then
			Set2Floor1.Color = Color3.new(0.776471, 0.517647, 0)
			Colour1.Value = "Orange"
			Floor1.Value = "Set2Floor1"
			wait(5)
			Set2Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set2Floor1" then
			Set2Floor1.Color = Color3.new(0.776471, 0.517647, 0)
			Colour2.Value = "Orange"
			Floor2.Value = "Set2Floor1"
			wait(5)
			Set2Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set2Floor1" and Floor2.Value ~= "Set2Floor1" then
			if order == true then
				Set2Floor1.Color = Color3.new(0.776471, 0.517647, 0)
				Colour1.Value = "Orange"
				Floor1.Value = "Set2Floor1"
				wait(5)
				Set2Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set2Floor1.Color = Color3.new(0.776471, 0.517647, 0)
				Colour2.Value = "Orange"
				Floor2.Value = "Set2Floor1"
				wait(5)
				Set2Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set2Floor2.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set2Floor2" then
			Set2Floor2.Color = Color3.new(0.333333, 0.333333, 1)
			Colour1.Value = "Blue"
			Floor1.Value = "Set2Floor2"
			wait(5)
			Set2Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set2Floor2" then
			Set2Floor2.Color = Color3.new(0.333333, 0.333333, 1)
			Colour2.Value = "Blue"
			Floor2.Value = "Set2Floor2"
			wait(5)
			Set2Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set2Floor2" and Floor2.Value ~= "Set2Floor2" then
			if order == true then
				Set2Floor2.Color = Color3.new(0.333333, 0.333333, 1)
				Colour1.Value = "Blue"
				Floor1.Value = "Set2Floor2"
				wait(5)
				Set2Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set2Floor2.Color = Color3.new(0.333333, 0.333333, 1)
				Colour2.Value = "Blue"
				Floor2.Value = "Set2Floor2"
				wait(5)
				Set2Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set2Floor3.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set2Floor3" then
			Set2Floor3.Color = Color3.new(0.666667, 1, 0)
			Colour1.Value = "Yellow"
			Floor1.Value = "Set2Floor3"
			wait(5)
			Set2Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set2Floor3" then
			Set2Floor3.Color = Color3.new(0.666667, 1, 0)
			Colour2.Value = "Yellow"
			Floor2.Value = "Set2Floor3"
			wait(5)
			Set2Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set2Floor3" and Floor2.Value ~= "Set2Floor3" then
			if order == true then
				Set2Floor3.Color = Color3.new(0.666667, 1, 0)
				Colour1.Value = "Yellow"
				Floor1.Value = "Set2Floor3"
				wait(5)
				Set2Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set2Floor3.Color = Color3.new(0.666667, 1, 0)
				Colour2.Value = "Yellow"
				Floor2.Value = "Set2Floor3"
				wait(5)
				Set2Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set2Floor4.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set2Floor4" then
			Set2Floor4.Color = Color3.new(1, 0, 0)
			Colour1.Value = "Red"
			Floor1.Value = "Set2Floor4"
			wait(5)
			Set2Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set2Floor4" then
			Set2Floor4.Color = Color3.new(1, 0, 0)
			Colour2.Value = "Red"
			Floor2.Value = "Set2Floor4"
			wait(5)
			Set2Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set2Floor4" and Floor2.Value ~= "Set2Floor4" then
			if order == true then
				Set2Floor4.Color = Color3.new(1, 0, 0)
				Colour1.Value = "Red"
				Floor1.Value = "Set2Floor4"
				wait(5)
				Set2Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set2Floor4.Color = Color3.new(1, 0, 0)
				Colour2.Value = "Red"
				Floor2.Value = "Set2Floor4"
				wait(5)
				Set2Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set2Floor5.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set2Floor5" then
			Set2Floor5.Color = Color3.new(0.666667, 1, 0)
			Colour1.Value = "Yellow"
			Floor1.Value = "Set2Floor5"
			wait(5)
			Set2Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set2Floor5" then
			Set2Floor5.Color = Color3.new(0.666667, 1, 0)
			Colour2.Value = "Yellow"
			Floor2.Value = "Set2Floor5"
			wait(5)
			Set2Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set2Floor5" and Floor2.Value ~= "Set2Floor5" then
			if order == true then
				Set2Floor5.Color = Color3.new(0.666667, 1, 0)
				Colour1.Value = "Yellow"
				Floor1.Value = "Set2Floor5"
				wait(5)
				Set2Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set2Floor5.Color = Color3.new(0.666667, 1, 0)
				Colour2.Value = "Yellow"
				Floor2.Value = "Set2Floor5"
				wait(5)
				Set2Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set3Floor1.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set3Floor1" then
			Set3Floor1.Color = Color3.new(0.333333, 1, 0.498039)
			Colour1.Value = "Green"
			Floor1.Value = "Set3Floor1"
			wait(5)
			Set3Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set3Floor1" then
			Set3Floor1.Color = Color3.new(0.333333, 1, 0.498039)
			Colour2.Value = "Green"
			Floor2.Value = "Set3Floor1"
			wait(5)
			Set3Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set3Floor1" and Floor2.Value ~= "Set3Floor1" then
			if order == true then
				Set3Floor1.Color = Color3.new(0.333333, 1, 0.498039)
				Colour1.Value = "Green"
				Floor1.Value = "Set3Floor1"
				wait(5)
				Set3Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set3Floor1.Color = Color3.new(0.333333, 1, 0.498039)
				Colour2.Value = "Green"
				Floor2.Value = "Set3Floor1"
				wait(5)
				Set3Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set3Floor2.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set3Floor2" then
			Set3Floor2.Color = Color3.new(0.333333, 0.333333, 1)
			Colour1.Value = "Blue"
			Floor1.Value = "Set3Floor2"
			wait(5)
			Set3Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set3Floor2" then
			Set3Floor2.Color = Color3.new(0.333333, 0.333333, 1)
			Colour2.Value = "Blue"
			Floor2.Value = "Set3Floor2"
			wait(5)
			Set3Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set3Floor2" and Floor2.Value ~= "Set3Floor2" then
			if order == true then
				Set3Floor2.Color = Color3.new(0.333333, 0.333333, 1)
				Colour1.Value = "Blue"
				Floor1.Value = "Set3Floor2"
				wait(5)
				Set3Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set3Floor2.Color = Color3.new(0.333333, 0.333333, 1)
				Colour2.Value = "Blue"
				Floor2.Value = "Set3Floor2"
				wait(5)
				Set3Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set3Floor3.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set3Floor3" then
			Set3Floor3.Color = Color3.new(1, 0, 0)
			Colour1.Value = "Red"
			Floor1.Value = "Set3Floor3"
			wait(5)
			Set3Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set3Floor3" then
			Set3Floor3.Color = Color3.new(1, 0, 0)
			Colour2.Value = "Red"
			Floor2.Value = "Set3Floor3"
			wait(5)
			Set3Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set3Floor3" and Floor2.Value ~= "Set3Floor3" then
			if order == true then
				Set3Floor3.Color = Color3.new(1, 0, 0)
				Colour1.Value = "Red"
				Floor1.Value = "Set3Floor3"
				wait(5)
				Set3Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set3Floor3.Color = Color3.new(1, 0, 0)
				Colour2.Value = "Red"
				Floor2.Value = "Set3Floor3"
				wait(5)
				Set3Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set3Floor4.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set3Floor4" then
			Set3Floor4.Color = Color3.new(0.666667, 1, 0)
			Colour1.Value = "Yellow"
			Floor1.Value = "Set3Floor4"
			wait(5)
			Set3Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set3Floor4" then
			Set3Floor4.Color = Color3.new(0.666667, 1, 0)
			Colour2.Value = "Yellow"
			Floor2.Value = "Set3Floor4"
			wait(5)
			Set3Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set3Floor4" and Floor2.Value ~= "Set3Floor4" then
			if order == true then
				Set3Floor4.Color = Color3.new(0.666667, 1, 0)
				Colour1.Value = "Yellow"
				Floor1.Value = "Set3Floor4"
				wait(5)
				Set3Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set3Floor4.Color = Color3.new(0.666667, 1, 0)
				Colour2.Value = "Yellow"
				Floor2.Value = "Set3Floor4"
				wait(5)
				Set3Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set3Floor5.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set3Floor5" then
			Set3Floor5.Color = Color3.new(0.333333, 1, 0.498039)
			Colour1.Value = "Green"
			Floor1.Value = "Set3Floor5"
			wait(5)
			Set3Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set3Floor5" then
			Set3Floor5.Color = Color3.new(0.333333, 1, 0.498039)
			Colour2.Value = "Green"
			Floor2.Value = "Set3Floor5"
			wait(5)
			Set3Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set3Floor5" and Floor2.Value ~= "Set3Floor5" then
			if order == true then
				Set3Floor5.Color = Color3.new(0.333333, 1, 0.498039)
				Colour1.Value = "Green"
				Floor1.Value = "Set3Floor5"
				wait(5)
				Set3Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set3Floor5.Color = Color3.new(0.333333, 1, 0.498039)
				Colour2.Value = "Green"
				Floor2.Value = "Set3Floor5"
				wait(5)
				Set3Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set4Floor1.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set4Floor1" then
			Set4Floor1.Color = Color3.new(1, 0, 0)
			Colour1.Value = "Red"
			Floor1.Value = "Set4Floor1"
			wait(5)
			Set4Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set4Floor1" then
			Set4Floor1.Color = Color3.new(1, 0, 0)
			Colour2.Value = "Red"
			Floor2.Value = "Set4Floor1"
			wait(5)
			Set4Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set4Floor1" and Floor2.Value ~= "Set4Floor1" then
			if order == true then
				Set4Floor1.Color = Color3.new(1, 0, 0)
				Colour1.Value = "Red"
				Floor1.Value = "Set4Floor1"
				wait(5)
				Set4Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set4Floor1.Color = Color3.new(1, 0, 0)
				Colour2.Value = "Red"
				Floor2.Value = "Set4Floor1"
				wait(5)
				Set4Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set4Floor2.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set4Floor2" then
			Set4Floor2.Color = Color3.new(0.333333, 0.333333, 1)
			Colour1.Value = "Blue"
			Floor1.Value = "Set4Floor2"
			wait(5)
			Set4Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set4Floor2" then
			Set4Floor2.Color = Color3.new(0.333333, 0.333333, 1)
			Colour2.Value = "Blue"
			Floor2.Value = "Set4Floor2"
			wait(5)
			Set4Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set4Floor2" and Floor2.Value ~= "Set4Floor2" then
			if order == true then
				Set4Floor2.Color = Color3.new(0.333333, 0.333333, 1)
				Colour1.Value = "Blue"
				Floor1.Value = "Set4Floor2"
				wait(5)
				Set4Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set4Floor2.Color = Color3.new(0.333333, 0.333333, 1)
				Colour2.Value = "Blue"
				Floor2.Value = "Set4Floor2"
				wait(5)
				Set4Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set4Floor3.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set4Floor3" then
			Set4Floor3.Color = Color3.new(0.776471, 0.517647, 0)
			Colour1.Value = "Orange"
			Floor1.Value = "Set4Floor3"
			wait(5)
			Set4Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set4Floor3" then
			Set4Floor3.Color = Color3.new(0.776471, 0.517647, 0)
			Colour2.Value = "Orange"
			Floor2.Value = "Set4Floor3"
			wait(5)
			Set4Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set4Floor3" and Floor2.Value ~= "Set4Floor3" then
			if order == true then
				Set4Floor3.Color = Color3.new(0.776471, 0.517647, 0)
				Colour1.Value = "Orange"
				Floor1.Value = "Set4Floor3"
				wait(5)
				Set4Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set4Floor3.Color = Color3.new(0.776471, 0.517647, 0)
				Colour2.Value = "Orange"
				Floor2.Value = "Set4Floor3"
				wait(5)
				Set4Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set4Floor4.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set4Floor4" then
			Set4Floor4.Color = Color3.new(1, 0, 0)
			Colour1.Value = "Red"
			Floor1.Value = "Set4Floor4"
			wait(5)
			Set4Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set4Floor4" then
			Set4Floor4.Color = Color3.new(1, 0, 0)
			Colour2.Value = "Red"
			Floor2.Value = "Set4Floor4"
			wait(5)
			Set4Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set4Floor4" and Floor2.Value ~= "Set4Floor4" then
			if order == true then
				Set4Floor4.Color = Color3.new(1, 0, 0)
				Colour1.Value = "Red"
				Floor1.Value = "Set4Floor4"
				wait(5)
				Set4Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set4Floor4.Color = Color3.new(1, 0, 0)
				Colour2.Value = "Red"
				Floor2.Value = "Set4Floor4"
				wait(5)
				Set4Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set4Floor5.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set4Floor5" then
			Set4Floor5.Color = Color3.new(0.333333, 0.333333, 1)
			Colour1.Value = "Blue"
			Floor1.Value = "Set4Floor5"
			wait(5)
			Set4Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set4Floor5" then
			Set4Floor5.Color = Color3.new(0.333333, 0.333333, 1)
			Colour2.Value = "Blue"
			Floor2.Value = "Set4Floor5"
			wait(5)
			Set4Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set4Floor5" and Floor2.Value ~= "Set4Floor5" then
			if order == true then
				Set4Floor5.Color = Color3.new(0.333333, 0.333333, 1)
				Colour1.Value = "Blue"
				Floor1.Value = "Set4Floor5"
				wait(5)
				Set4Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set4Floor5.Color = Color3.new(0.333333, 0.333333, 1)
				Colour2.Value = "Blue"
				Floor2.Value = "Set4Floor5"
				wait(5)
				Set4Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set5Floor1.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set5Floor1" then
			Set5Floor1.Color = Color3.new(0.666667, 1, 0)
			Colour1.Value = "Yellow"
			Floor1.Value = "Set5Floor1"
			wait(5)
			Set5Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set5Floor1" then
			Set5Floor1.Color = Color3.new(0.666667, 1, 0)
			Colour2.Value = "Yellow"
			Floor2.Value = "Set5Floor1"
			wait(5)
			Set5Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set5Floor1" and Floor2.Value ~= "Set5Floor1" then
			if order == true then
				Set5Floor1.Color = Color3.new(0.666667, 1, 0)
				Colour1.Value = "Yellow"
				Floor1.Value = "Set5Floor1"
				wait(5)
				Set5Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set5Floor1.Color = Color3.new(0.666667, 1, 0)
				Colour2.Value = "Yellow"
				Floor2.Value = "Set5Floor1"
				wait(5)
				Set5Floor1.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set5Floor2.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set5Floor2" then
			Set5Floor2.Color = Color3.new(0.333333, 1, 0.498039)
			Colour1.Value = "Green"
			Floor1.Value = "Set5Floor2"
			wait(5)
			Set5Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set5Floor2" then
			Set5Floor2.Color = Color3.new(0.333333, 1, 0.498039)
			Colour2.Value = "Green"
			Floor2.Value = "Set5Floor2"
			wait(5)
			Set5Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set5Floor2" and Floor2.Value ~= "Set5Floor2" then
			if order == true then
				Set5Floor2.Color = Color3.new(0.333333, 1, 0.498039)
				Colour1.Value = "Green"
				Floor1.Value = "Set5Floor2"
				wait(5)
				Set5Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set5Floor2.Color = Color3.new(0.333333, 1, 0.498039)
				Colour2.Value = "Green"
				Floor2.Value = "Set5Floor2"
				wait(5)
				Set5Floor2.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set5Floor3.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set5Floor3" then
			Set5Floor3.Color = Color3.new(0.666667, 1, 0)
			Colour1.Value = "Yellow"
			Floor1.Value = "Set5Floor3"
			wait(5)
			Set5Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set5Floor3" then
			Set5Floor3.Color = Color3.new(0.666667, 1, 0)
			Colour2.Value = "Yellow"
			Floor2.Value = "Set5Floor3"
			wait(5)
			Set5Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set5Floor3" and Floor2.Value ~= "Set5Floor3" then
			if order == true then
				Set5Floor3.Color = Color3.new(0.666667, 1, 0)
				Colour1.Value = "Yellow"
				Floor1.Value = "Set5Floor3"
				wait(5)
				Set5Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set5Floor3.Color = Color3.new(0.666667, 1, 0)
				Colour2.Value = "Yellow"
				Floor2.Value = "Set5Floor3"
				wait(5)
				Set5Floor3.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set5Floor4.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set5Floor4" then
			Set5Floor4.Color = Color3.new(0.333333, 0.333333, 1)
			Colour1.Value = "Blue"
			Floor1.Value = "Set5Floor4"
			wait(5)
			Set5Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set5Floor4" then
			Set5Floor4.Color = Color3.new(0.333333, 0.333333, 1)
			Colour2.Value = "Blue"
			Floor2.Value = "Set5Floor4"
			wait(5)
			Set5Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set5Floor4" and Floor2.Value ~= "Set5Floor4" then
			if order == true then
				Set5Floor4.Color = Color3.new(0.333333, 0.333333, 1)
				Colour1.Value = "Blue"
				Floor1.Value = "Set5Floor4"
				wait(5)
				Set5Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set5Floor4.Color = Color3.new(0.333333, 0.333333, 1)
				Colour2.Value = "Blue"
				Floor2.Value = "Set5Floor4"
				wait(5)
				Set5Floor4.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)

Set5Floor5.Touched:Connect(function(hit)
	if hit.Parent == char and Win.Value == "No" then
		if Colour1.Value == "" and Floor2.Value ~= "Set5Floor5" then
			Set5Floor5.Color = Color3.new(1, 0, 0)
			Colour1.Value = "Red"
			Floor1.Value = "Set5Floor5"
			wait(5)
			Set5Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value == "" and Floor1.Value ~= "Set5Floor5" then
			Set5Floor5.Color = Color3.new(1, 0, 0)
			Colour2.Value = "Red"
			Floor2.Value = "Set5Floor5"
			wait(5)
			Set5Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
		elseif Colour1.Value ~= "" and Colour2.Value ~= "" and Floor1.Value ~= "Set5Floor5" and Floor2.Value ~= "Set5Floor5" then
			if order == true then
				Set5Floor5.Color = Color3.new(1, 0, 0)
				Colour1.Value = "Red"
				Floor1.Value = "Set5Floor5"
				wait(5)
				Set5Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = false
			else
				Set5Floor5.Color = Color3.new(1, 0, 0)
				Colour2.Value = "Red"
				Floor2.Value = "Set5Floor5"
				wait(5)
				Set5Floor5.Color = Color3.new(0.639216, 0.635294, 0.647059)
				order = true
			end
		end
	end
end)
3 Likes

Well seems like your trying to kill anyone that sees your code. Format it in code blocks by adding three backquotes (“`”) before and after the code on a new line.

2 Likes
local Set1 = game.Workspace[“1”]
local Set2 = game.Workspace[“2”]
local Set3 = game.Workspace[“3”]
local Set4 = game.Workspace[“4”]
local Set5 = game.Workspace[“5”]

Can be replaced with:

local Sets = {}
for i = 1, 5 do
  local Set = workspace[tostring(i)]
  Sets[Set] = {}
end

Then,

local Set1Floor1 = Set1:WaitForChild(“Floor1”)
local Set1Floor2 = Set1:WaitForChild(“Floor2”)
local Set1Floor3 = Set1:WaitForChild(“Floor3”)
local Set1Floor4 = Set1:WaitForChild(“Floor4”)
local Set1Floor5 = Set1:WaitForChild(“Floor5”)
local Set2Floor1 = Set2:WaitForChild(“Floor1”)
local Set2Floor2 = Set2:WaitForChild(“Floor2”)
local Set2Floor3 = Set2:WaitForChild(“Floor3”)
local Set2Floor4 = Set2:WaitForChild(“Floor4”)
local Set2Floor5 = Set2:WaitForChild(“Floor5”)
local Set3Floor1 = Set3:WaitForChild(“Floor1”)
local Set3Floor2 = Set3:WaitForChild(“Floor2”)
local Set3Floor3 = Set3:WaitForChild(“Floor3”)
local Set3Floor4 = Set3:WaitForChild(“Floor4”)
local Set3Floor5 = Set3:WaitForChild(“Floor5”)
local Set4Floor1 = Set4:WaitForChild(“Floor1”)
local Set4Floor2 = Set4:WaitForChild(“Floor2”)
local Set4Floor3 = Set4:WaitForChild(“Floor3”)
local Set4Floor4 = Set4:WaitForChild(“Floor4”)
local Set4Floor5 = Set4:WaitForChild(“Floor5”)
local Set5Floor1 = Set5:WaitForChild(“Floor1”)
local Set5Floor2 = Set5:WaitForChild(“Floor2”)
local Set5Floor3 = Set5:WaitForChild(“Floor3”)
local Set5Floor4 = Set5:WaitForChild(“Floor4”)
local Set5Floor5 = Set5:WaitForChild(“Floor5”)

can be replaced with:

for Set, Floors in Sets do
  local Floors = {}
  
  for i = 1, 5 do
    Floors[i] = Set:WaitForChild("Floor" .. tostring(i))
  end
  
  Sets[Set] = Floors
end

If you join these together it becomes:

-- Get sets
local Sets = {}
for i = 1, 5 do
  local Set = workspace[tostring(i)]
  Sets[Set] = {}
end

-- Get floors in sets
for Set, Floors in Sets do
  local Floors = {}
  
  for i = 1, 5 do
    Floors[i] = Set:WaitForChild("Floor" .. tostring(i))
  end
  
  Sets[Set] = Floors
end

Keep doing this for the rest of your code.

5 Likes

thx for your help, how can I solve this?

Try to use functions and you can .random rather than all of this.

1 Like

I don’t know how to use functions and random

A basic function, takes a number and prints it’s double:

local function aBasicFunction(num)
	print(num*2)
end

Using the math library’s random function:

local randomNum = math.random(1,5) -- random number between 1-5
2 Likes

but i don’t know how to combine it with the code

1 Like