Run it
Copy the script and paste it into your executor.
player = .Players.LocalPlayer
playerGui = player:()
playerGui:()
playerGui.SnakeUI:()
gui = .()
gui.Name =
gui.ResetOnSpawn =
gui.Parent = playerGui
window = .()
window.Size = .(, , , )
window.Position = .(, -, , -)
window.BackgroundColor3 = .(, , )
window.BorderSizePixel =
window.Parent = gui
titleBar = .(, window)
titleBar.Size = .(, , , )
titleBar.BackgroundColor3 = .(, , )
title = .(, titleBar)
title.Size = .(, , , )
title.Text =
title.TextColor3 = .(,,)
title.BackgroundTransparency =
title.Font = .Font.SourceSansBold
title.TextSize =
dragging =
dragStart, startPos
titleBar.InputBegan:((input)
input.UserInputType == .UserInputType.MouseButton1 input.UserInputType == .UserInputType.Touch
dragging =
dragStart = input.Position
startPos = window.Position
)
titleBar.InputEnded:((input)
input.UserInputType == .UserInputType.MouseButton1 input.UserInputType == .UserInputType.Touch
dragging =
)
:().InputChanged:((input)
dragging (input.UserInputType == .UserInputType.MouseMovement input.UserInputType == .UserInputType.Touch)
delta = input.Position - dragStart
window.Position = .(
startPos.X.Scale,
startPos.X.Offset + delta.X,
startPos.Y.Scale,
startPos.Y.Offset + delta.Y
)
)
scoreLabel = .(, window)
scoreLabel.Position = .(, , , )
scoreLabel.Size = .(, -, , )
scoreLabel.BackgroundTransparency =
scoreLabel.TextColor3 = .(,,)
scoreLabel.Font = .Font.SourceSansBold
scoreLabel.TextSize =
scoreLabel.Text =
gameFrame = .(, window)
gameFrame.Position = .(, , , )
gameFrame.Size = .(, -, , )
gameFrame.BackgroundColor3 = .(, , )
controls = .(, window)
controls.Position = .(, , , -)
controls.Size = .(, , , )
controls.BackgroundTransparency =
(text, pos)
btn = .(, controls)
btn.Size = .(, , , )
btn.Position = pos
btn.Text = text
btn.BackgroundColor3 = .(,,)
btn.TextScaled =
btn
up = (, .(, -, , ))
down = (, .(, -, , ))
left = (, .(, -, , ))
right = (, .(, , , ))
gameOverLabel = .(, gameFrame)
gameOverLabel.Size = .(, , , )
gameOverLabel.Position = .(, , , )
gameOverLabel.Text =
gameOverLabel.TextColor3 = .(,,)
gameOverLabel.BackgroundTransparency =
gameOverLabel.TextScaled =
gameOverLabel.Visible =
finalScoreLabel = .(, gameFrame)
finalScoreLabel.Size = .(, , , )
finalScoreLabel.Position = .(, , , )
finalScoreLabel.BackgroundTransparency =
finalScoreLabel.TextColor3 = .(,,)
finalScoreLabel.TextScaled =
finalScoreLabel.Visible =
retryButton = .(, gameFrame)
retryButton.Size = .(, , , )
retryButton.Position = .(, , , )
retryButton.Text =
retryButton.Visible =
gridSize =
cellSize =
cells = {}
x = , gridSize
y = , gridSize
cell = .(, gameFrame)
cell.Size = .(, cellSize, , cellSize)
cell.Position = .(, (x-)*cellSize, , (y-)*cellSize)
cell.BackgroundColor3 = .(,,)
cells[x....y] = cell
snake, direction, food, alive
score =
highScore =
()
scoreLabel.Text = ..score....highScore
()
snake = {{x = , y = }}
direction =
food = {x = .(, gridSize), y = .(, gridSize)}
alive =
score =
gameOverLabel.Visible =
retryButton.Visible =
finalScoreLabel.Visible =
()
()
up.MouseButton1Click:(() alive direction = )
down.MouseButton1Click:(() alive direction = )
left.MouseButton1Click:(() alive direction = )
right.MouseButton1Click:(() alive direction = )
retryButton.MouseButton1Click:(startGame)
.(()
.()
alive
head = {x = snake[].x, y = snake[].y}
direction == head.y -=
direction == head.y +=
direction == head.x -=
direction == head.x +=
head.x < head.y < head.x > gridSize head.y > gridSize
alive =
_, part (snake)
head.x == part.x head.y == part.y
alive =
alive
score > highScore
highScore = score
gameOverLabel.Visible =
finalScoreLabel.Text = ..score
finalScoreLabel.Visible =
retryButton.Visible =
()
.(snake, , head)
head.x == food.x head.y == food.y
score +=
()
food = {x = .(, gridSize), y = .(, gridSize)}
.(snake)
_, cell (cells)
cell.BackgroundColor3 = .(,,)
_, part (snake)
cells[part.x....part.y].BackgroundColor3 = .(,,)
cells[food.x....food.y].BackgroundColor3 = .(,,)
)basic snake script dude. i got tired of my dumb knowledge of lua and js asked chatgpt idfc flame me all you want

Universal