-- ============================================================ -- SKID ENGINE – FINAL WORKING -- ============================================================ local Players = game:GetService("Players") local Player = Players.LocalPlayer local UserInputService = game:GetService("UserInputService") -- === CREATE GUI === local screenGui = Instance.new("ScreenGui") screenGui.Name = "SKID_IDE" screenGui.Parent = Player.PlayerGui screenGui.ResetOnSpawn = false -- === MAIN FRAME (black outline, white inside, rounded) === local mainFrame = Instance.new("Frame") mainFrame.Size = UDim2.new(0, 380, 0, 320) -- compact mainFrame.Position = UDim2.new(0.5, -190, 0.5, -160) mainFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255) -- white inside mainFrame.BorderSizePixel = 2 mainFrame.BorderColor3 = Color3.fromRGB(0, 0, 0) -- black border mainFrame.ClipsDescendants = true mainFrame.Parent = screenGui local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 12) -- rounded corners corner.Parent = mainFrame -- === DRAGGING === local drag = false local dragStart, startPos mainFrame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then drag = true dragStart = input.Position startPos = mainFrame.Position end end) mainFrame.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then drag = false end end) mainFrame.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then if drag then local delta = input.Position - dragStart mainFrame.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y ) end end end) -- === HEADER (black) === local header = Instance.new("Frame") header.Size = UDim2.new(1, 0, 0, 28) header.BackgroundColor3 = Color3.fromRGB(0, 0, 0) -- black header header.BorderSizePixel = 0 header.Parent = mainFrame local headerCorner = Instance.new("UICorner") headerCorner.CornerRadius = UDim.new(0, 12) headerCorner.Parent = header -- Decal (left) local logo = Instance.new("ImageLabel") logo.Size = UDim2.new(0, 20, 0, 20) logo.Position = UDim2.new(0, 6, 0, 4) logo.BackgroundTransparency = 1 logo.Image = "rbxassetid://102690385896397" -- CHANGE THIS logo.Parent = header -- Title (centered, white) local title = Instance.new("TextLabel") title.Size = UDim2.new(1, -110, 1, 0) title.Position = UDim2.new(0, 0, 0, 0) title.BackgroundTransparency = 1 title.Text = "SKID ENGINE" title.TextColor3 = Color3.fromRGB(255, 255, 255) -- white text title.TextSize = 14 title.TextXAlignment = Enum.TextXAlignment.Center title.Font = Enum.Font.Code title.Parent = header -- Close button (white on black) local closeBtn = Instance.new("TextButton") closeBtn.Size = UDim2.new(0, 22, 0, 22) closeBtn.Position = UDim2.new(1, -26, 0, 3) closeBtn.BackgroundColor3 = Color3.fromRGB(0, 0, 0) closeBtn.BorderSizePixel = 1 closeBtn.BorderColor3 = Color3.fromRGB(255, 255, 255) closeBtn.Text = "X" closeBtn.TextColor3 = Color3.fromRGB(255, 255, 255) closeBtn.TextSize = 12 closeBtn.Font = Enum.Font.Code closeBtn.Parent = header local cCorner = Instance.new("UICorner") cCorner.CornerRadius = UDim.new(0, 4) cCorner.Parent = closeBtn closeBtn.MouseButton1Click:Connect(function() screenGui.Enabled = false end) -- === LAYOUT: Output (left) + Editor (right) === local outputPanel = Instance.new("Frame") outputPanel.Size = UDim2.new(0, 130, 1, -60) outputPanel.Position = UDim2.new(0, 4, 0, 34) outputPanel.BackgroundColor3 = Color3.fromRGB(240, 240, 240) -- light grey outputPanel.BorderSizePixel = 1 outputPanel.BorderColor3 = Color3.fromRGB(0, 0, 0) outputPanel.ClipsDescendants = true outputPanel.Parent = mainFrame local opCorner = Instance.new("UICorner") opCorner.CornerRadius = UDim.new(0, 6) opCorner.Parent = outputPanel local outputBox = Instance.new("TextBox") outputBox.Size = UDim2.new(1, -6, 1, -4) outputBox.Position = UDim2.new(0, 3, 0, 2) outputBox.BackgroundTransparency = 1 outputBox.BorderSizePixel = 0 outputBox.TextColor3 = Color3.fromRGB(0, 0, 0) outputBox.TextSize = 10 outputBox.TextXAlignment = Enum.TextXAlignment.Left outputBox.TextYAlignment = Enum.TextYAlignment.Top outputBox.Text = "// Ready" outputBox.TextWrapped = true outputBox.Font = Enum.Font.Code outputBox.ClearTextOnFocus = false outputBox.Parent = outputPanel -- === EDITOR === local editorFrame = Instance.new("Frame") editorFrame.Size = UDim2.new(1, -142, 1, -60) editorFrame.Position = UDim2.new(0, 140, 0, 34) editorFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255) -- white editorFrame.BorderSizePixel = 1 editorFrame.BorderColor3 = Color3.fromRGB(0, 0, 0) editorFrame.Parent = mainFrame local eCorner = Instance.new("UICorner") eCorner.CornerRadius = UDim.new(0, 6) eCorner.Parent = editorFrame local textBox = Instance.new("TextBox") textBox.Size = UDim2.new(1, -6, 1, -4) textBox.Position = UDim2.new(0, 3, 0, 2) textBox.BackgroundTransparency = 1 textBox.BorderSizePixel = 0 textBox.TextColor3 = Color3.fromRGB(0, 0, 0) textBox.TextSize = 11 textBox.TextXAlignment = Enum.TextXAlignment.Left textBox.TextYAlignment = Enum.TextYAlignment.Top textBox.Text = [[ // Let's type your code print--{Hello World!} ]] textBox.TextWrapped = true textBox.MultiLine = true textBox.Font = Enum.Font.Code textBox.ClearTextOnFocus = false textBox.Parent = editorFrame -- === BUTTONS === local btnFrame = Instance.new("Frame") btnFrame.Size = UDim2.new(1, -8, 0, 30) btnFrame.Position = UDim2.new(0, 4, 1, -34) btnFrame.BackgroundTransparency = 1 btnFrame.Parent = mainFrame local function makeBtn(name, text, color, pos) local b = Instance.new("TextButton") b.Size = UDim2.new(0, 48, 0, 22) b.Position = pos b.BackgroundColor3 = color b.BorderSizePixel = 1 b.BorderColor3 = Color3.fromRGB(0, 0, 0) b.Text = text b.TextColor3 = Color3.fromRGB(0, 0, 0) b.TextSize = 10 b.Font = Enum.Font.Code b.Parent = btnFrame local c = Instance.new("UICorner") c.CornerRadius = UDim.new(0, 4) c.Parent = b return b end local runBtn = makeBtn("RunBtn", "RUN", Color3.fromRGB(200, 200, 200), UDim2.new(0, 0, 0, 4)) local clearBtn = makeBtn("ClearBtn", "CLR", Color3.fromRGB(200, 200, 200), UDim2.new(0, 53, 0, 4)) local helpBtn = makeBtn("HelpBtn", "HELP", Color3.fromRGB(200, 200, 200), UDim2.new(0, 106, 0, 4)) local exBtn = makeBtn("ExBtn", "EX", Color3.fromRGB(200, 200, 200), UDim2.new(0, 159, 0, 4)) local outToggleBtn = makeBtn("OutToggle", "OUT", Color3.fromRGB(200, 200, 200), UDim2.new(0, 212, 0, 4)) -- === OUTPUT TOGGLE === local outputVisible = true outToggleBtn.MouseButton1Click:Connect(function() outputVisible = not outputVisible outputPanel.Visible = outputVisible if outputVisible then editorFrame.Size = UDim2.new(1, -142, 1, -60) editorFrame.Position = UDim2.new(0, 140, 0, 34) outToggleBtn.Text = "OUT" else editorFrame.Size = UDim2.new(1, -8, 1, -60) editorFrame.Position = UDim2.new(0, 4, 0, 34) outToggleBtn.Text = "HIDE" end end) -- === HELP PANEL === local helpFrame = Instance.new("Frame") helpFrame.Size = UDim2.new(0, 220, 0, 160) helpFrame.Position = UDim2.new(0.5, -110, 0.5, -80) helpFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255) helpFrame.BorderSizePixel = 2 helpFrame.BorderColor3 = Color3.fromRGB(0, 0, 0) helpFrame.Visible = false helpFrame.Parent = mainFrame local hCorner = Instance.new("UICorner") hCorner.CornerRadius = UDim.new(0, 8) hCorner.Parent = helpFrame local helpDrag = false local helpDragStart, helpStartPos helpFrame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then helpDrag = true helpDragStart = input.Position helpStartPos = helpFrame.Position end end) helpFrame.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then helpDrag = false end end) helpFrame.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then if helpDrag then local delta = input.Position - helpDragStart helpFrame.Position = UDim2.new( helpStartPos.X.Scale, helpStartPos.X.Offset + delta.X, helpStartPos.Y.Scale, helpStartPos.Y.Offset + delta.Y ) end end end) local helpClose = Instance.new("TextButton") helpClose.Size = UDim2.new(0, 18, 0, 18) helpClose.Position = UDim2.new(1, -22, 0, 3) helpClose.BackgroundColor3 = Color3.fromRGB(0, 0, 0) helpClose.BorderSizePixel = 0 helpClose.Text = "X" helpClose.TextColor3 = Color3.fromRGB(255, 255, 255) helpClose.TextSize = 10 helpClose.Font = Enum.Font.Code helpClose.Parent = helpFrame local hcCorner = Instance.new("UICorner") hcCorner.CornerRadius = UDim.new(0, 4) hcCorner.Parent = helpClose helpClose.MouseButton1Click:Connect(function() helpFrame.Visible = false end) local helpTitle = Instance.new("TextLabel") helpTitle.Size = UDim2.new(1, -10, 0, 16) helpTitle.Position = UDim2.new(0, 8, 0, 2) helpTitle.BackgroundTransparency = 1 helpTitle.Text = "COMMANDS" helpTitle.TextColor3 = Color3.fromRGB(0, 0, 0) helpTitle.TextSize = 11 helpTitle.TextXAlignment = Enum.TextXAlignment.Left helpTitle.Font = Enum.Font.Code helpTitle.Parent = helpFrame local helpScroll = Instance.new("ScrollingFrame") helpScroll.Size = UDim2.new(1, -8, 1, -24) helpScroll.Position = UDim2.new(0, 4, 0, 20) helpScroll.BackgroundColor3 = Color3.fromRGB(240, 240, 240) helpScroll.BorderSizePixel = 1 helpScroll.BorderColor3 = Color3.fromRGB(0, 0, 0) helpScroll.Parent = helpFrame local helpList = Instance.new("UIListLayout") helpList.Parent = helpScroll helpList.Padding = UDim.new(0, 1) local cmds = { "print--{text}", "set var = value", "math { expr }", "if cond { }", "elif cond { }", "else { }", "end", "for var = s to e { }", "while cond { }", "repeat this{N}", "function name(p) { }", "return value", "len() type()", "// comment" } for _, c in ipairs(cmds) do local l = Instance.new("TextLabel") l.Size = UDim2.new(1, 0, 0, 14) l.BackgroundTransparency = 1 l.Text = c l.TextColor3 = Color3.fromRGB(0, 0, 0) l.TextSize = 10 l.TextXAlignment = Enum.TextXAlignment.Left l.Font = Enum.Font.Code l.Parent = helpScroll end helpScroll.CanvasSize = UDim2.new(0, 0, 0, #cmds * 16) -- === INPUT MODAL === local inputModal = Instance.new("Frame") inputModal.Size = UDim2.new(0, 250, 0, 120) inputModal.Position = UDim2.new(0.5, -125, 0.5, -60) inputModal.BackgroundColor3 = Color3.fromRGB(255, 255, 255) inputModal.BorderSizePixel = 2 inputModal.BorderColor3 = Color3.fromRGB(0, 0, 0) inputModal.Visible = false inputModal.Parent = mainFrame local mCorner = Instance.new("UICorner") mCorner.CornerRadius = UDim.new(0, 8) mCorner.Parent = inputModal inputModal.ZIndex = 10 local inputLabel = Instance.new("TextLabel") inputLabel.Size = UDim2.new(1, -20, 0, 24) inputLabel.Position = UDim2.new(0, 10, 0, 8) inputLabel.BackgroundTransparency = 1 inputLabel.Text = "Enter value:" inputLabel.TextColor3 = Color3.fromRGB(0, 0, 0) inputLabel.TextSize = 14 inputLabel.TextXAlignment = Enum.TextXAlignment.Left inputLabel.Font = Enum.Font.Code inputLabel.Parent = inputModal local inputBox = Instance.new("TextBox") inputBox.Size = UDim2.new(1, -20, 0, 28) inputBox.Position = UDim2.new(0, 10, 0, 36) inputBox.BackgroundColor3 = Color3.fromRGB(240, 240, 240) inputBox.BorderSizePixel = 1 inputBox.BorderColor3 = Color3.fromRGB(0, 0, 0) inputBox.Text = "" inputBox.TextColor3 = Color3.fromRGB(0, 0, 0) inputBox.TextSize = 14 inputBox.Font = Enum.Font.Code inputBox.ClearTextOnFocus = false inputBox.Parent = inputModal local ibCorner = Instance.new("UICorner") ibCorner.CornerRadius = UDim.new(0, 4) ibCorner.Parent = inputBox local inputSubmit = Instance.new("TextButton") inputSubmit.Size = UDim2.new(0, 60, 0, 26) inputSubmit.Position = UDim2.new(1, -70, 1, -32) inputSubmit.BackgroundColor3 = Color3.fromRGB(0, 0, 0) inputSubmit.BorderSizePixel = 0 inputSubmit.Text = "OK" inputSubmit.TextColor3 = Color3.fromRGB(255, 255, 255) inputSubmit.TextSize = 14 inputSubmit.Font = Enum.Font.Code inputSubmit.Parent = inputModal local isCorner = Instance.new("UICorner") isCorner.CornerRadius = UDim.new(0, 4) isCorner.Parent = inputSubmit local inputCancel = Instance.new("TextButton") inputCancel.Size = UDim2.new(0, 60, 0, 26) inputCancel.Position = UDim2.new(1, -140, 1, -32) inputCancel.BackgroundColor3 = Color3.fromRGB(200, 200, 200) inputCancel.BorderSizePixel = 1 inputCancel.BorderColor3 = Color3.fromRGB(0, 0, 0) inputCancel.Text = "Cancel" inputCancel.TextColor3 = Color3.fromRGB(0, 0, 0) inputCancel.TextSize = 14 inputCancel.Font = Enum.Font.Code inputCancel.Parent = inputModal local icCorner = Instance.new("UICorner") icCorner.CornerRadius = UDim.new(0, 4) icCorner.Parent = inputCancel -- ============================================================ -- SIMPLIFIED INTERPRETER (PRINT FIXED) -- ============================================================ local function runSkid(code) local variables = {} local functions = {} local output = "" local loopCount = 0 local maxLoops = 10000 local function parseValue(v) local str = tostring(v):match("^%s*(.-)%s*$") if str:match('^".*"$') or str:match("^'.*'$") then return str:sub(2, -2) end if str == "true" then return true end if str == "false" then return false end if str == "null" then return nil end local num = tonumber(str) if num then return num end if variables[str] ~= nil then return variables[str] end if str:match("^%[.*%]$") then local content = str:sub(2, -2) local arr = {} for item in content:gmatch("[^,]+") do table.insert(arr, parseValue(item:match("^%s*(.-)%s*$"))) end return arr end if str:match("^{.*}$") then local content = str:sub(2, -2) local obj = {} for pair in content:gmatch("[^,]+") do local key, val = pair:match("^%s*([%w_]+)%s*:%s*(.-)%s*$") if key and val then obj[key] = parseValue(val) end end return obj end return str end local function executeBlock(block) local i = 1 while i <= #block do loopCount = loopCount + 1 if loopCount > maxLoops then return "Error: Max loop count exceeded (" .. maxLoops .. ")" end local line = block[i]:match("^%s*(.-)%s*$") if line == "" or line:sub(1,2) == "//" then i = i + 1 continue end -- ======================================== -- PRINT (using simple string search) -- ======================================== local printStart = line:find("print--{", 1, true) if printStart then local openBracePos = printStart + 8 -- 'print--{' length is 8? Actually "print--{" is 8 characters: p r i n t - - { → 8. local closeBracePos = line:find("}", openBracePos, true) if closeBracePos then local content = line:sub(openBracePos, closeBracePos - 1) -- exclude braces local result = "" for part in content:gmatch("[^+]+") do local val = parseValue(part:match("^%s*(.-)%s*$")) result = result .. tostring(val) end output = output .. result .. "\n" end i = i + 1 continue end -- ======================================== -- SET variable -- ======================================== if line:match("^set%s+") then local name, val = line:match("^set%s+([%w_]+)%s*=%s*(.*)$") if name and val then if val:match("^input%s+") then local prompt = val:match("^input%s+(.*)") local inputVal = "" inputLabel.Text = tostring(parseValue(prompt)) inputBox.Text = "" inputModal.Visible = true inputBox:CaptureFocus() local done = false local result = "" local submitConn = inputSubmit.MouseButton1Click:Connect(function() result = inputBox.Text inputModal.Visible = false done = true end) local cancelConn = inputCancel.MouseButton1Click:Connect(function() result = "" inputModal.Visible = false done = true end) local focusConn = inputBox.FocusLost:Connect(function(enter) if enter then result = inputBox.Text inputModal.Visible = false done = true end end) while not done do wait() end submitConn:Disconnect() cancelConn:Disconnect() focusConn:Disconnect() inputVal = result variables[name] = inputVal else variables[name] = parseValue(val) end end i = i + 1 continue end -- ======================================== -- MATH -- ======================================== if line:match("^math%s*{") and line:match("}$") then local expr = line:match("{(.*)}") if expr then local ok, result = pcall(function() return loadstring("return " .. expr)() end) if ok then output = output .. tostring(result) .. "\n" else output = output .. "Math error\n" end end i = i + 1 continue end -- ======================================== -- FOR loop -- ======================================== if line:match("^for%s+") then local varName, startVal, endVal, stepVal if line:match("step%s+") then varName, startVal, endVal, stepVal = line:match("^for%s+([%w_]+)%s*=%s*(%S+)%s+to%s+(%S+)%s+step%s+(%S+)%s*{%s*$") else varName, startVal, endVal = line:match("^for%s+([%w_]+)%s*=%s*(%S+)%s+to%s+(%S+)%s*{%s*$") stepVal = "1" end if varName and startVal and endVal then local s = parseValue(startVal) local e = parseValue(endVal) local step = tonumber(parseValue(stepVal or "1")) or 1 local startPos = i + 1 local depth = 1 local endPos = startPos while endPos <= #block and depth > 0 do local l = block[endPos]:match("^%s*(.-)%s*$") if l:match("^for%s+") then depth = depth + 1 elseif l == "end" then depth = depth - 1 end if depth > 0 then endPos = endPos + 1 end end local sub = {} for j = startPos, endPos - 1 do table.insert(sub, block[j]) end for val = s, e, step do variables[varName] = val local result = executeBlock(sub) if type(result) == "string" and result:match("Error") then return result end end i = endPos + 1 else i = i + 1 end continue end -- ======================================== -- WHILE loop -- ======================================== if line:match("^while%s+") then local cond = line:match("^while%s+(.-)%s*{%s*$") if cond then local startPos = i + 1 local depth = 1 local endPos = startPos while endPos <= #block and depth > 0 do local l = block[endPos]:match("^%s*(.-)%s*$") if l:match("^while%s+") then depth = depth + 1 elseif l == "end" then depth = depth - 1 end if depth > 0 then endPos = endPos + 1 end end local sub = {} for j = startPos, endPos - 1 do table.insert(sub, block[j]) end while parseValue(cond) do local result = executeBlock(sub) if type(result) == "string" and result:match("Error") then return result end end i = endPos + 1 else i = i + 1 end continue end -- ======================================== -- REPEAT loop -- ======================================== if line:match("^repeat%s+this%s*{%s*(%d+)%s*}%s*$") then local cnt = tonumber(line:match("repeat%s+this%s*{%s*(%d+)%s*}")) if cnt then local startPos = i + 1 local depth = 1 local endPos = startPos while endPos <= #block and depth > 0 do local l = block[endPos]:match("^%s*(.-)%s*$") if l:match("^repeat%s+this") then depth = depth + 1 elseif l == "repeat end" then depth = depth - 1 end if depth > 0 then endPos = endPos + 1 end end local sub = {} for j = startPos, endPos - 1 do table.insert(sub, block[j]) end for _ = 1, cnt do local result = executeBlock(sub) if type(result) == "string" and result:match("Error") then return result end end i = endPos + 1 else i = i + 1 end continue end -- ======================================== -- IF / ELIF / ELSE -- ======================================== if line:match("^if%s+") or line:match("^elif%s+") then local isIf = line:match("^if%s+") local cond if isIf then cond = line:match("^if%s+(.-)%s*{%s*$") else cond = line:match("^elif%s+(.-)%s*{%s*$") end local condTrue = false if cond then if cond:match("==") then local a, b = cond:match("(.-)%s*==%s*(.*)") condTrue = (parseValue(a) == parseValue(b)) elseif cond:match("!=") then local a, b = cond:match("(.-)%s*!=%s*(.*)") condTrue = (parseValue(a) ~= parseValue(b)) elseif cond:match(">=") then local a, b = cond:match("(.-)%s*>=%s*(.*)") condTrue = (parseValue(a) >= parseValue(b)) elseif cond:match("<=") then local a, b = cond:match("(.-)%s*<=%s*(.*)") condTrue = (parseValue(a) <= parseValue(b)) elseif cond:match(">") then local a, b = cond:match("(.-)%s*>(.*)") condTrue = (parseValue(a) > parseValue(b)) elseif cond:match("<") then local a, b = cond:match("(.-)%s*<(.*)") condTrue = (parseValue(a) < parseValue(b)) else condTrue = parseValue(cond) ~= nil and parseValue(cond) ~= false end end local startPos = i + 1 local depth = 1 local endPos = startPos local elsePos = nil local elifPositions = {} while endPos <= #block and depth > 0 do local l = block[endPos]:match("^%s*(.-)%s*$") if l:match("^if%s+") or l:match("^elif%s+") then if depth == 1 then table.insert(elifPositions, endPos) end depth = depth + 1 elseif l:match("^else%s*{%s*$") and depth == 1 then elsePos = endPos depth = depth + 1 elseif l == "end" then depth = depth - 1 end if depth > 0 then endPos = endPos + 1 end end local sub = {} if condTrue then local stop = elsePos or (elifPositions[1] or endPos) for j = startPos, stop - 1 do table.insert(sub, block[j]) end local result = executeBlock(sub) if type(result) == "string" and result:match("Error") then return result end else local foundElif = false for _, pos in ipairs(elifPositions) do local elifLine = block[pos]:match("^%s*(.-)%s*$") local elifCond = elifLine:match("^elif%s+(.-)%s*{%s*$") if elifCond then local elifTrue = false if elifCond:match("==") then local a, b = elifCond:match("(.-)%s*==%s*(.*)") elifTrue = (parseValue(a) == parseValue(b)) elseif elifCond:match("!=") then local a, b = elifCond:match("(.-)%s*!=%s*(.*)") elifTrue = (parseValue(a) ~= parseValue(b)) elseif elifCond:match(">") then local a, b = elifCond:match("(.-)%s*>(.*)") elifTrue = (parseValue(a) > parseValue(b)) elseif elifCond:match("<") then local a, b = elifCond:match("(.-)%s*<(.*)") elifTrue = (parseValue(a) < parseValue(b)) else elifTrue = parseValue(elifCond) ~= nil and parseValue(elifCond) ~= false end if elifTrue then local nextPos = elsePos or endPos for j = pos + 1, nextPos - 1 do table.insert(sub, block[j]) end local result = executeBlock(sub) if type(result) == "string" and result:match("Error") then return result end foundElif = true break end end end if not foundElif and elsePos then for j = elsePos + 1, endPos - 1 do table.insert(sub, block[j]) end local result = executeBlock(sub) if type(result) == "string" and result:match("Error") then return result end end end i = endPos + 1 continue end -- ======================================== -- FUNCTION definition -- ======================================== if line:match("^function%s+[%w_]+%s*%(.*%)%s*{%s*$") then local name, paramsStr = line:match("^function%s+([%w_]+)%s*%((.-)%)%s*{%s*$") if name then local params = {} if paramsStr and paramsStr ~= "" then for p in paramsStr:gmatch("[^,]+") do table.insert(params, p:match("^%s*(.-)%s*$")) end end local startPos = i + 1 local depth = 1 local endPos = startPos while endPos <= #block and depth > 0 do local l = block[endPos]:match("^%s*(.-)%s*$") if l:match("^function%s+") then depth = depth + 1 elseif l == "end" then depth = depth - 1 end if depth > 0 then endPos = endPos + 1 end end local body = {} for j = startPos, endPos - 1 do table.insert(body, block[j]) end functions[name] = { params = params, body = body } i = endPos + 1 else i = i + 1 end continue end -- ======================================== -- RETURN -- ======================================== if line:match("^return%s+") then local val = line:match("^return%s+(.*)") return parseValue(val) end -- ======================================== -- FUNCTION CALL -- ======================================== if line:match("^[%w_]+%s*%(") and not line:match("^set") and not line:match("^if") then local name = line:match("^([%w_]+)%s*%(") if name and functions[name] then local argsStr = line:match("%((.*)%)") local args = {} if argsStr then for a in argsStr:gmatch("[^,]+") do table.insert(args, parseValue(a:match("^%s*(.-)%s*$"))) end end local func = functions[name] local localVars = {} for i, param in ipairs(func.params) do localVars[param] = args[i] or nil end local oldVars = variables variables = localVars local ret = executeBlock(func.body) variables = oldVars if ret ~= nil and type(ret) ~= "string" then output = output .. tostring(ret) .. "\n" end else local argsStr = line:match("%((.*)%)") local args = {} if argsStr then for a in argsStr:gmatch("[^,]+") do table.insert(args, parseValue(a:match("^%s*(.-)%s*$"))) end end if name == "len" then output = output .. tostring(len(args[1])) .. "\n" elseif name == "type" then output = output .. tostring(typeof(args[1])) .. "\n" end end i = i + 1 continue end i = i + 1 end return nil end local lines = {} for line in code:gmatch("[^\n]*") do table.insert(lines, line) end local err = executeBlock(lines) if type(err) == "string" and err:match("Error") then output = output .. err .. "\n" end return output end -- === BUTTON ACTIONS === runBtn.MouseButton1Click:Connect(function() local code = textBox.Text local result = runSkid(code) if result ~= nil and result ~= "" then outputBox.Text = result else outputBox.Text = "// No output" end end) clearBtn.MouseButton1Click:Connect(function() outputBox.Text = "// Cleared" end) helpBtn.MouseButton1Click:Connect(function() helpFrame.Visible = not helpFrame.Visible if helpFrame.Visible then helpFrame.Position = UDim2.new(0.5, -110, 0.5, -80) end end) local examples = { [[print--{Hello World!}]], [[set x = 42 print--{x = + x}]], [[set i = 1 repeat this{5} print--{Loop: + i} i = i + 1 repeat end]], [[function add(a,b) { return a + b } end print--{3+4 = + add(3,4)}]] } local exIdx = 1 exBtn.MouseButton1Click:Connect(function() textBox.Text = examples[exIdx] exIdx = exIdx % #examples + 1 outputBox.Text = "// Loaded example" end) -- === KEYBOARD SHORTCUTS === UserInputService.InputBegan:Connect(function(input, gp) if gp then return end if input.KeyCode == Enum.KeyCode.R and UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) then runBtn.MouseButton1Click:Fire() end if input.KeyCode == Enum.KeyCode.F5 then runBtn.MouseButton1Click:Fire() end if input.KeyCode == Enum.KeyCode.F1 then helpBtn.MouseButton1Click:Fire() end end) -- === TOGGLE (F12) === UserInputService.InputBegan:Connect(function(input, gp) if gp then return end if input.KeyCode == Enum.KeyCode.F12 then screenGui.Enabled = not screenGui.Enabled end end) print("SKID Engine loaded! Press F12 to toggle.")