waypoints
Key RequiredUniversal

waypoints

Universal ScriptYolkaCoderRBYolkaCoderRB 1.1K views 2.2K executesUpdated Sep 24, 2026
Unrated
00
Lua Script•552 lines (18336 chars)
--[[
    Waypoint System + Notification System v4
    - Исправлена кнопка сворачивания/разворачивания
    - Работающее перетаскивание
    - Компактное окно
]]

local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local CoreGui = game:GetService("CoreGui")
local TweenService = game:GetService("TweenService")

local player = Players.LocalPlayer

-- ============================================================
-- 1. NOTIFICATION SYSTEM
-- ============================================================
local NotificationSystem = {}

local notifScreenGui = Instance.new("ScreenGui")
notifScreenGui.Name = "NotificationSystem"
notifScreenGui.Parent = CoreGui

local notifHolder = Instance.new("Frame")
notifHolder.Size = UDim2.new(0, 260, 1, 0)
notifHolder.Position = UDim2.new(1, -270, 0, 0)
notifHolder.BackgroundTransparency = 1
notifHolder.Parent = notifScreenGui

local notifLayout = Instance.new("UIListLayout")
notifLayout.SortOrder = Enum.SortOrder.LayoutOrder
notifLayout.Padding = UDim.new(0, 6)
notifLayout.VerticalAlignment = Enum.VerticalAlignment.Top
notifLayout.Parent = notifHolder

local notifPadding = Instance.new("UIPadding")
notifPadding.PaddingTop = UDim.new(0, 10)
notifPadding.Parent = notifHolder

local notifOrder = 0

function NotificationSystem.notify(title, message, color, duration)
    color = color or Color3.fromRGB(0, 130, 255)
    duration = duration or 3
    notifOrder = notifOrder + 1

    local notif = Instance.new("Frame")
    notif.Size = UDim2.new(1, -10, 0, 50)
    notif.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
    notif.BackgroundTransparency = 0.1
    notif.BorderSizePixel = 0
    notif.LayoutOrder = notifOrder
    notif.Parent = notifHolder

    local corner = Instance.new("UICorner")
    corner.CornerRadius = UDim.new(0, 10)
    corner.Parent = notif

    local accent = Instance.new("Frame")
    accent.Size = UDim2.new(0, 4, 1, -10)
    accent.Position = UDim2.new(0, 5, 0, 5)
    accent.BackgroundColor3 = color
    accent.BorderSizePixel = 0
    accent.Parent = notif

    local accentCorner = Instance.new("UICorner")
    accentCorner.CornerRadius = UDim.new(1, 0)
    accentCorner.Parent = accent

    local titleLabel = Instance.new("TextLabel")
    titleLabel.Size = UDim2.new(1, -25, 0, 20)
    titleLabel.Position = UDim2.new(0, 18, 0, 5)
    titleLabel.Text = title
    titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
    titleLabel.BackgroundTransparency = 1
    titleLabel.Font = Enum.Font.GothamBold
    titleLabel.TextSize = 13
    titleLabel.TextXAlignment = Enum.TextXAlignment.Left
    titleLabel.Parent = notif

    local msgLabel = Instance.new("TextLabel")
    msgLabel.Size = UDim2.new(1, -25, 0, 20)
    msgLabel.Position = UDim2.new(0, 18, 0, 25)
    msgLabel.Text = message
    msgLabel.TextColor3 = Color3.fromRGB(180, 180, 180)
    msgLabel.BackgroundTransparency = 1
    msgLabel.Font = Enum.Font.Gotham
    msgLabel.TextSize = 11
    msgLabel.TextXAlignment = Enum.TextXAlignment.Left
    msgLabel.TextWrapped = true
    msgLabel.Parent = notif

    notif.Position = UDim2.new(1, 280, 0, 0)
    TweenService:Create(notif, TweenInfo.new(0.35, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {
        Position = UDim2.new(0, 0, 0, 0)
    }):Play()

    task.delay(duration, function()
        local out = TweenService:Create(notif, TweenInfo.new(0.35, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {
            Position = UDim2.new(1, 280, 0, 0)
        })
        out:Play()
        out.Completed:Connect(function()
            notif:Destroy()
        end)
    end)
end

-- ============================================================
-- 2. WAYPOINT DATA
-- ============================================================
local SAVE_FILE = "waypoints.json"
local waypoints = {}

local function loadWaypoints()
    if writefile and readfile and isfile then
        if isfile(SAVE_FILE) then
            local ok, data = pcall(function()
                return game:GetService("HttpService"):JSONDecode(readfile(SAVE_FILE))
            end)
            if ok and type(data) == "table" then
                waypoints = data
                return
            end
        end
    end
    waypoints = {}
end

local function saveWaypoints()
    if writefile then
        pcall(function()
            writefile(SAVE_FILE, game:GetService("HttpService"):JSONEncode(waypoints))
        end)
    end
end

loadWaypoints()

-- ============================================================
-- 3. GUI
-- ============================================================
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "WaypointSystem"
screenGui.Parent = CoreGui

local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 260, 0, 360)
frame.Position = UDim2.new(0.5, -130, 0.5, -180)
frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
frame.BackgroundTransparency = 0.12
frame.BorderSizePixel = 0
frame.ClipsDescendants = true
frame.Active = true
frame.Parent = screenGui

local frameCorner = Instance.new("UICorner")
frameCorner.CornerRadius = UDim.new(0, 14)
frameCorner.Parent = frame

-- Заголовок
local titleBar = Instance.new("Frame")
titleBar.Size = UDim2.new(1, -10, 0, 32)
titleBar.Position = UDim2.new(0, 5, 0, 5)
titleBar.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
titleBar.BorderSizePixel = 0
titleBar.Active = true
titleBar.Parent = frame

local titleCorner = Instance.new("UICorner")
titleCorner.CornerRadius = UDim.new(0, 10)
titleCorner.Parent = titleBar

local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, -75, 1, 0)
title.Position = UDim2.new(0, 8, 0, 0)
title.Text = "Waypoints"
title.TextColor3 = Color3.fromRGB(255, 255, 255)
title.BackgroundTransparency = 1
title.Font = Enum.Font.GothamBold
title.TextSize = 15
title.TextXAlignment = Enum.TextXAlignment.Left
title.Parent = titleBar

-- Кнопка свернуть
local collapseBtn = Instance.new("TextButton")
collapseBtn.Size = UDim2.new(0, 28, 0, 28)
collapseBtn.Position = UDim2.new(1, -62, 0, 2)
collapseBtn.Text = "-"
collapseBtn.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
collapseBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
collapseBtn.BorderSizePixel = 0
collapseBtn.Font = Enum.Font.GothamBold
collapseBtn.TextSize = 18
collapseBtn.Parent = titleBar

local collapseCorner = Instance.new("UICorner")
collapseCorner.CornerRadius = UDim.new(0, 6)
collapseCorner.Parent = collapseBtn

-- Кнопка закрытия
local closeBtn = Instance.new("TextButton")
closeBtn.Size = UDim2.new(0, 28, 0, 28)
closeBtn.Position = UDim2.new(1, -32, 0, 2)
closeBtn.Text = "X"
closeBtn.BackgroundColor3 = Color3.fromRGB(180, 40, 40)
closeBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
closeBtn.BorderSizePixel = 0
closeBtn.Font = Enum.Font.GothamBold
closeBtn.TextSize = 14
closeBtn.Parent = titleBar

local closeCorner = Instance.new("UICorner")
closeCorner.CornerRadius = UDim.new(0, 6)
closeCorner.Parent = closeBtn

-- Контейнер содержимого
local contentFrame = Instance.new("Frame")
contentFrame.Size = UDim2.new(1, 0, 1, -42)
contentFrame.Position = UDim2.new(0, 0, 0, 42)
contentFrame.BackgroundTransparency = 1
contentFrame.Parent = frame

-- Поле ввода + кнопка добавить
local inputBox = Instance.new("TextBox")
inputBox.Size = UDim2.new(1, -100, 0, 30)
inputBox.Position = UDim2.new(0, 10, 0, 3)
inputBox.PlaceholderText = "Name..."
inputBox.Text = ""
inputBox.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
inputBox.TextColor3 = Color3.fromRGB(255, 255, 255)
inputBox.BorderSizePixel = 0
inputBox.Font = Enum.Font.Gotham
inputBox.TextSize = 12
inputBox.Parent = contentFrame

local inputCorner = Instance.new("UICorner")
inputCorner.CornerRadius = UDim.new(0, 8)
inputCorner.Parent = inputBox

local addBtn = Instance.new("TextButton")
addBtn.Size = UDim2.new(0, 75, 0, 30)
addBtn.Position = UDim2.new(1, -85, 0, 3)
addBtn.Text = "+ Save"
addBtn.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
addBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
addBtn.BorderSizePixel = 0
addBtn.Font = Enum.Font.GothamBold
addBtn.TextSize = 12
addBtn.Parent = contentFrame

local addCorner = Instance.new("UICorner")
addCorner.CornerRadius = UDim.new(0, 8)
addCorner.Parent = addBtn

-- Поиск
local searchBox = Instance.new("TextBox")
searchBox.Size = UDim2.new(1, -20, 0, 26)
searchBox.Position = UDim2.new(0, 10, 0, 43)
searchBox.PlaceholderText = "Search..."
searchBox.Text = ""
searchBox.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
searchBox.TextColor3 = Color3.fromRGB(255, 255, 255)
searchBox.BorderSizePixel = 0
searchBox.Font = Enum.Font.Gotham
searchBox.TextSize = 12
searchBox.Parent = contentFrame

local searchCorner = Instance.new("UICorner")
searchCorner.CornerRadius = UDim.new(0, 8)
searchCorner.Parent = searchBox

-- Список
local listFrame = Instance.new("ScrollingFrame")
listFrame.Size = UDim2.new(1, -20, 1, -80)
listFrame.Position = UDim2.new(0, 10, 0, 78)
listFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
listFrame.BorderSizePixel = 0
listFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
listFrame.ScrollBarThickness = 6
listFrame.Parent = contentFrame

local listCorner = Instance.new("UICorner")
listCorner.CornerRadius = UDim.new(0, 8)
listCorner.Parent = listFrame

local listLayout = Instance.new("UIListLayout")
listLayout.Padding = UDim.new(0, 5)
listLayout.SortOrder = Enum.SortOrder.LayoutOrder
listLayout.Parent = listFrame

local listPadding = Instance.new("UIPadding")
listPadding.PaddingTop = UDim.new(0, 5)
listPadding.PaddingLeft = UDim.new(0, 5)
listPadding.PaddingRight = UDim.new(0, 5)
listPadding.Parent = listFrame

-- ============================================================
-- 4. ФУНКЦИИ
-- ============================================================
local renderList

local function teleportTo(pos)
    local char = player.Character
    if not char then
        NotificationSystem.notify("Error", "Character not found", Color3.fromRGB(255, 80, 80))
        return
    end
    local hrp = char:FindFirstChild("HumanoidRootPart")
    if not hrp then
        NotificationSystem.notify("Error", "No HumanoidRootPart", Color3.fromRGB(255, 80, 80))
        return
    end
    hrp.CFrame = CFrame.new(pos.x, pos.y, pos.z)
end

local function getPlayerPosition()
    local char = player.Character
    if not char then return nil end
    local hrp = char:FindFirstChild("HumanoidRootPart")
    if not hrp then return nil end
    local p = hrp.Position
    return {x = p.X, y = p.Y, z = p.Z}
end

local function deleteWaypoint(index)
    local wp = waypoints[index]
    if not wp then return end
    table.remove(waypoints, index)
    saveWaypoints()
    NotificationSystem.notify("Deleted", "Waypoint removed", Color3.fromRGB(255, 100, 100))
    renderList(searchBox.Text)
end

renderList = function(filter)
    filter = filter and filter:lower() or ""
    for _, child in pairs(listFrame:GetChildren()) do
        if child:IsA("Frame") or child:IsA("TextButton") or child:IsA("TextLabel") then
            child:Destroy()
        end
    end

    local count = 0
    for i, wp in ipairs(waypoints) do
        if filter == "" or wp.name:lower():find(filter, 1, true) then
            count = count + 1

            local row = Instance.new("Frame")
            row.Size = UDim2.new(1, -10, 0, 34)
            row.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
            row.BorderSizePixel = 0
            row.LayoutOrder = i
            row.Parent = listFrame

            local rowCorner = Instance.new("UICorner")
            rowCorner.CornerRadius = UDim.new(0, 6)
            rowCorner.Parent = row

            local nameBtn = Instance.new("TextButton")
            nameBtn.Size = UDim2.new(1, -80, 1, 0)
            nameBtn.Position = UDim2.new(0, 0, 0, 0)
            nameBtn.Text = "  " .. wp.name
            nameBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
            nameBtn.BackgroundTransparency = 1
            nameBtn.Font = Enum.Font.GothamBold
            nameBtn.TextSize = 12
            nameBtn.TextXAlignment = Enum.TextXAlignment.Left
            nameBtn.Parent = row

            nameBtn.MouseButton1Click:Connect(function()
                teleportTo(wp)
                NotificationSystem.notify("Teleport", "Moved to " .. wp.name, Color3.fromRGB(0, 200, 255), 2)
            end)

            local delBtn = Instance.new("TextButton")
            delBtn.Size = UDim2.new(0, 28, 0, 28)
            delBtn.Position = UDim2.new(1, -60, 0, 3)
            delBtn.Text = "X"
            delBtn.BackgroundColor3 = Color3.fromRGB(150, 40, 40)
            delBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
            delBtn.BorderSizePixel = 0
            delBtn.Font = Enum.Font.GothamBold
            delBtn.TextSize = 13
            delBtn.Parent = row

            local delCorner = Instance.new("UICorner")
            delCorner.CornerRadius = UDim.new(0, 6)
            delCorner.Parent = delBtn

            delBtn.MouseButton1Click:Connect(function()
                deleteWaypoint(i)
            end)

            local renBtn = Instance.new("TextButton")
            renBtn.Size = UDim2.new(0, 28, 0, 28)
            renBtn.Position = UDim2.new(1, -30, 0, 3)
            renBtn.Text = "E"
            renBtn.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
            renBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
            renBtn.BorderSizePixel = 0
            renBtn.Font = Enum.Font.GothamBold
            renBtn.TextSize = 13
            renBtn.Parent = row

            local renCorner = Instance.new("UICorner")
            renCorner.CornerRadius = UDim.new(0, 6)
            renCorner.Parent = renBtn

            renBtn.MouseButton1Click:Connect(function()
                inputBox.Text = wp.name
                inputBox:CaptureFocus()
                local conn
                conn = addBtn.MouseButton1Click:Connect(function()
                    if inputBox.Text ~= "" then
                        waypoints[i].name = inputBox.Text
                        saveWaypoints()
                        NotificationSystem.notify("Renamed", "New name: " .. inputBox.Text, Color3.fromRGB(0, 200, 255))
                    end
                    inputBox.Text = ""
                    renderList(searchBox.Text)
                    conn:Disconnect()
                end)
            end)
        end
    end

    if count == 0 then
        local empty = Instance.new("TextLabel")
        empty.Size = UDim2.new(1, -10, 0, 30)
        empty.BackgroundTransparency = 1
        empty.Text = "No waypoints. Add one!"
        empty.TextColor3 = Color3.fromRGB(120, 120, 120)
        empty.Font = Enum.Font.Gotham
        empty.TextSize = 12
        empty.Parent = listFrame
    end

    listFrame.CanvasSize = UDim2.new(0, 0, 0, listLayout.AbsoluteContentSize.Y + 12)
end

addBtn.MouseButton1Click:Connect(function()
    local name = inputBox.Text
    if name == "" then
        NotificationSystem.notify("Error", "Enter a name", Color3.fromRGB(255, 200, 0))
        return
    end
    local pos = getPlayerPosition()
    if not pos then
        NotificationSystem.notify("Error", "Can't get position", Color3.fromRGB(255, 80, 80))
        return
    end
    table.insert(waypoints, {name = name, x = pos.x, y = pos.y, z = pos.z})
    saveWaypoints()
    inputBox.Text = ""
    renderList(searchBox.Text)
    NotificationSystem.notify("Saved", "Waypoint added", Color3.fromRGB(0, 200, 0))
end)

searchBox:GetPropertyChangedSignal("Text"):Connect(function()
    renderList(searchBox.Text)
end)

-- ============================================================
-- 5. СВОРАЧИВАНИЕ / РАЗВОРАЧИВАНИЕ (исправлено)
-- ============================================================
local isCollapsed = false
local FULL_HEIGHT = 360
local COLLAPSED_HEIGHT = 42
local lastToggle = 0

local function toggleCollapse()
    -- Защита от двойного срабатывания (MouseButton1Click + TouchTap)
    if tick() - lastToggle < 0.3 then return end
    lastToggle = tick()

    isCollapsed = not isCollapsed
    if isCollapsed then
        collapseBtn.Text = "+"
        contentFrame.Visible = false
        frame.Size = UDim2.new(0, 260, 0, COLLAPSED_HEIGHT)
    else
        collapseBtn.Text = "-"
        contentFrame.Visible = true
        frame.Size = UDim2.new(0, 260, 0, FULL_HEIGHT)
    end
end

-- Только один обработчик (работает и для мыши, и для касаний)
collapseBtn.MouseButton1Click:Connect(toggleCollapse)
-- TouchTap НЕ подключаем, чтобы избежать двойного срабатывания

-- Закрытие
closeBtn.MouseButton1Click:Connect(function()
    screenGui:Destroy()
end)

-- ============================================================
-- 6. ПЕРЕТАСКИВАНИЕ
-- ============================================================
local isDragging = false
local dragStart, startPos

local function startDrag(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
        isDragging = true
        dragStart = input.Position
        startPos = frame.Position
    end
end

local function updateDrag(input)
    if not isDragging then return end
    if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
        local delta = input.Position - dragStart
        frame.Position = UDim2.new(
            startPos.X.Scale,
            startPos.X.Offset + delta.X,
            startPos.Y.Scale,
            startPos.Y.Offset + delta.Y
        )
    end
end

local function endDrag(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
        isDragging = false
    end
end

titleBar.InputBegan:Connect(startDrag)
titleBar.InputChanged:Connect(updateDrag)
titleBar.InputEnded:Connect(endDrag)

UserInputService.InputChanged:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    if isDragging then
        updateDrag(input)
    end
end)

UserInputService.InputEnded:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    endDrag(input)
end)

-- ============================================================
-- 7. СТАРТ
-- ============================================================
renderList("")
NotificationSystem.notify("Waypoints", "Loaded. Total: " .. #waypoints, Color3.fromRGB(0, 130, 255))

print("[Waypoints v4] Loaded. Total: " .. #waypoints)

Features & Information

Waypoint Script!

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts