[Connect Four] Four In A Row System

I recently made a Connect Four System.

The system is designed to be clean, customizable, and easy to set up, perfect for social games. It includes 50+ Configs inside ConnectFourConfig, supports Mobile, Console, and PC, and makes it simple to customize the Table, pieces, UI, and gameplay settings to fit your own game.

I’d really appreciate feedback on the gameplay feel, controls, and anything else that could be improved.

Solo test it here:

‎
‎
Purchase it here:
https://create.roblox.com/store/asset/128934894745450

‎

‎
‎
‎





https://gyazo.com/6aa04be2925982a59b3fa8b3a1e0a4e6.mp4

--[[
    Connect Four/Four In A Row System
    Version 1.0
    Made By @TheRealxLucas

Logs:

--]]
local Config = {}

Config.Board = {
	ModelNames = { "ConnectFour" },
	ContainerNames = { "ConnectFour" },
	SearchWorkspaceDescendants = true,
	DetectBoardModelsInsideContainers = true,
	DetectBoardsByPlacementFolder = false,

	PlacementFolderName = "Placement",
	PlacementNameFormat = "CoinPlacement_C%d_R%d",
	ProximityPromptName = "ProximityPrompt",
	DropPlacementName = "DropPlacement",
	SoloBoolValueName = "Solo",

	BoardIdAttribute = "ConnectFourBoardId",
	RuntimeCoinsFolderName = "ConnectFourRuntimeCoins",
	RuntimeHitboxesFolderName = "ConnectFourColumnHitboxes",
	RuntimeObjectsAttribute = "ConnectFourRuntimeObject",

	StartupWaitSeconds = 20,
}

Config.Gameplay = {
	Columns = 7,
	Rows = 6,
	PlayersRequired = 2,
	StartingPlayerIndex = 1,
	SoloControlsBothColors = true,

	LockInputWhileCoinIsDropping = true,
	AllowQueuedPlayerExit = true,
	ResetQueueWhenQueuedPlayerLeaves = true,
	EndMatchWhenPlayerCharacterLost = true,
}

Config.Seating = {
	Enabled = true,
	ChairNames = {
		[1] = "Player1Chair",
		[2] = "Player2Chair",
	},
	SeatPartName = "Seat",

	LockPlayersToChairs = true,
	ReseatIfTheyStand = true,
	ReseatDelay = 0.1,
	CharacterWaitSeconds = 8,
	SeatCFrameOffset = CFrame.new(0, 2.25, 0),
	ReleaseCFrameOffset = CFrame.new(0, 2.5, 4),
	ReleaseTeleportDelay = 0.15,
	RestoreChairOnRelease = true,

	Movement = {
		WalkSpeed = 0,
		JumpPower = 0,
		JumpHeight = 0,
		AutoRotate = false,
		DisableJumping = true,
		DisableGettingUp = true,
	},
}

Config.Coins = {
	FolderName = "Coins",
	PlayerCoinNames = {
		[1] = "redcoin",
		[2] = "yellowcoin",
	},

	FinalCoinNameFormat = "ConnectFourCoin_P%d_C%d_R%d",
	AnchorFinalCoins = true,
	DisableFinalCoinCollision = true,
	FinalCoinCFrameOffset = CFrame.new(),
	LocalCoinCFrameOffset = CFrame.new(),
}

Config.Prompt = {
	UseDynamicPlayerCountText = true,
	PlayerCountTextFormat = "%d/%d Players",

	EmptyText = "0/2 Players",
	OneQueuedText = "1/2 Players",
	FullText = "2/2 Players",
	InProgressText = "Game in progress",
	ObjectText = "Connect Four",
	LocalQueuedActionText = "Leave queue",

	KeepEnabledWhenFull = false,
	HoldDuration = 0,
	MaxActivationDistance = 12,
	RequiresLineOfSight = false,
}

Config.UI = {
	ScreenGuiName = "ConnectFourUI",
	ExitButtonName = "Exit",
	MobileDropButtonName = "MobileDrop",
	CreateMobileDropButtonIfMissing = true,
	MessagesLabelName = "Messages",
	WaitForGuiSeconds = 30,

	Text = {
		YourTurn = "Your turn",
		OpponentTurn = "Opponent's turn",
		YouWon = "You won!",
		YouLost = "You lost!",
		Tie = "Tie!",
		OpponentLeft = "Opponent left",
		YouLeft = "You left",
		GameFull = "Game in progress",
		AlreadyQueued = "You are already queued",
		WaitingForOpponent = "Waiting for opponent",
	},
}

Config.Remotes = {
	FolderName = "ConnectFourRemotes",
	RequestMove = "RequestMove",
	ExitMatch = "ExitMatch",
	StateUpdate = "StateUpdate",
	AnimateMove = "AnimateMove",
	PreviewColumn = "PreviewColumn",
	MoveRejected = "MoveRejected",
}

Config.Hitboxes = {
	Enabled = true,
	NameFormat = "ColumnHitbox_C%d",
	AttributeName = "ConnectFourColumnHitbox",

	UseClickDetectors = false,
	ClickDetectorName = "ColumnClickDetector",
	ClickDetectorMaxActivationDistance = 64,
	ClickDetectorCursorIcon = "",

	WidthScale = 0.9,
	HeightPadding = 1.25,
	Depth = 1.5,
	ForwardOffset = 0,

	Transparency = 1,
	CanCollide = false,
	CanTouch = false,
	CanQuery = true,
}

Config.Input = {
	UseClientRaycastFallback = true,
	UseScreenSpaceColumnSelection = true,
	ScreenSpaceColumnPaddingPixels = 28,
}

Config.Gamepad = {
	Enabled = true,
	PreviousColumnKeyCode = Enum.KeyCode.ButtonL1,
	NextColumnKeyCode = Enum.KeyCode.ButtonR1,
	DropKeyCode = Enum.KeyCode.ButtonR2,
	KeyboardAliasesEnabled = true,
	PreviousColumnKeyboardKeyCodes = { Enum.KeyCode.R },
	NextColumnKeyboardKeyCodes = { Enum.KeyCode.O },
	DropKeyboardKeyCodes = { Enum.KeyCode.P },
	DefaultColumn = 4,
	WrapColumns = false,
	ShowPreviewWhenTurnStarts = true,
}

Config.Preview = {
	Enabled = true,
	ShowForOpponent = true,
	Transparency = 0.3,
	UpdateEverySeconds = 0.03,
	Name = "LocalConnectFourPreviewCoin",
	CFrameOffset = CFrame.new(),
	UseDropPlacementHeight = true,
}

Config.Camera = {
	Enabled = true,
	RestoreOnExit = true,
	UseTween = true,
	TweenDuration = 0.5,
	TweenEasingStyle = Enum.EasingStyle.Sine,
	TweenEasingDirection = Enum.EasingDirection.InOut,
	TurnUnlockDelay = 0.85,
	RestoreRetryDelays = { 0, 0.15, 0.5, 1 },
	DefaultFieldOfView = 70,

	Distance = 6,
	Height = 2.0,
	SideOffset = 0,
	LookAtHeightOffset = 0.35,
	FieldOfView = 45,
	UseHitboxFacing = true,
	HitboxLookVectorSign = 1,
	FlipCameraOnTurnChange = true,
	CoinSideLookVectorSigns = {
		[1] = 1,
		[2] = -1,
	},
}

Config.CharacterFade = {
	Enabled = true,
	SoloFadeOnlyRealPlayerTurn = true,
	HideNameplates = true,
	HiddenTransparency = 1,
	TweenDuration = 0.3,
	TweenEasingStyle = Enum.EasingStyle.Sine,
	TweenEasingDirection = Enum.EasingDirection.InOut,
	FadeBaseParts = true,
	FadeDecalsAndTextures = true,
}

Config.Animation = {
	DropDuration = 0.55,
	FinalCoinSpawnDelay = 0.58,
	DefaultDropHeight = 5,
	DestroyLocalCoinDelay = 0.08,

	TweenEasingStyle = Enum.EasingStyle.Quad,
	TweenEasingDirection = Enum.EasingDirection.In,
}

Config.Sounds = {
	FolderName = "Sounds",
	BallDropName = "BallDrop",
	BallLandName = "BallLand",
	LocalSoundVolumeMultiplier = 1,
}

Config.Cleanup = {
	EndMessageSeconds = 3,
	ResetBoardAfterWinSeconds = 3,
	ResetBoardAfterExitSeconds = 1,
	ClearCoinsWhenMatchStarts = true,
	ClearCoinsWhenMatchEnds = true,
}

Config.Debug = {
	PrintBoardSetup = false,
	WarnOnMissingBoardPieces = true,
	WarnOnRejectedMoves = false,
}

return Config


I checked it out, looks like its working quite nicely. Could be nice for devs looking to add interactive props into their games. well done!

1 Like

The link create.roblox.com/store/asset/128934894745450 doesn’t work

It’s currently under review by Roblox, it always get auto disabled by roblox bot whenever I put it on sale, so I have to appeal it, happened to my 8 ball pool system too, it takes around a day.

2 Likes

Now works and can be purchased:
https://create.roblox.com/store/asset/128934894745450