CCCPaste

Custom Sky

--// StarterPlayerScripts LocalScript
local Players = game:GetService("Players")
local Lighting = game:GetService("Lighting")
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

--// Create ScreenGui
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "CustomSkyMenu"
screenGui.ResetOnSpawn = false
screenGui.Parent = playerGui

--// Open Button
local toggleFrame = Instance.new("Frame")
toggleFrame.Size = UDim2.new(0, 50, 0, 50)
toggleFrame.Position = UDim2.new(0, 10, 0, 10)
toggleFrame.BackgroundColor3 = Color3.fromRGB(50,50,50)
toggleFrame.BorderSizePixel = 0
toggleFrame.ClipsDescendants = true
toggleFrame.Parent = screenGui

local toggleUICorner = Instance.new("UICorner")
toggleUICorner.CornerRadius = UDim.new(0.5, 0)
toggleUICorner.Parent = toggleFrame

local toggleBtn = Instance.new("ImageButton")
toggleBtn.Size = UDim2.new(1,0,1,0)
toggleBtn.BackgroundTransparency = 1
toggleBtn.Image = "rbxassetid://78494414238159"
toggleBtn.Parent = toggleFrame

--// Main Frame
local mainFrame = Instance.new("Frame")
mainFrame.Size = UDim2.new(0,360,0,340)
mainFrame.Position = UDim2.new(0.5,0,0.5,0)
mainFrame.AnchorPoint = Vector2.new(0.5,0.5)
mainFrame.BackgroundColor3 = Color3.fromRGB(30,30,30)
mainFrame.BorderSizePixel = 0
mainFrame.Visible = false
mainFrame.ClipsDescendants = true
mainFrame.Parent = screenGui

local mainUICorner = Instance.new("UICorner")
mainUICorner.CornerRadius = UDim.new(0,12)
mainUICorner.Parent = mainFrame

--// Close Button
local closeBtn = Instance.new("TextButton")
closeBtn.Size = UDim2.new(0,30,0,30)
closeBtn.Position = UDim2.new(1,-35,0,5)
closeBtn.Text = "X"
closeBtn.TextColor3 = Color3.fromRGB(255,255,255)
closeBtn.BackgroundColor3 = Color3.fromRGB(180,0,0)
closeBtn.Font = Enum.Font.GothamBold
closeBtn.TextSize = 18
closeBtn.Parent = mainFrame

local closeUICorner = Instance.new("UICorner")
closeUICorner.CornerRadius = UDim.new(0,5)
closeUICorner.Parent = closeBtn

closeBtn.MouseButton1Click:Connect(function()
    mainFrame.Visible = false
end)

--// Title
local titleLabel = Instance.new("TextLabel")
titleLabel.Size = UDim2.new(1,-20,0,30)
titleLabel.Position = UDim2.new(0,10,0,10)
titleLabel.BackgroundTransparency = 1
titleLabel.Text = "Sky Settings"
titleLabel.TextColor3 = Color3.fromRGB(255,255,255)
titleLabel.Font = Enum.Font.GothamBold
titleLabel.TextSize = 24
titleLabel.TextXAlignment = Enum.TextXAlignment.Center
titleLabel.TextYAlignment = Enum.TextYAlignment.Center
titleLabel.Parent = mainFrame

--// Credits
local creditsLabel = Instance.new("TextLabel")
creditsLabel.Size = UDim2.new(1,-20,0,20)
creditsLabel.Position = UDim2.new(0,10,0,40)
creditsLabel.BackgroundTransparency = 1
creditsLabel.Text = "By @SukitoV1"
creditsLabel.TextColor3 = Color3.fromRGB(180,180,180)
creditsLabel.Font = Enum.Font.Gotham
creditsLabel.TextSize = 14
creditsLabel.TextXAlignment = Enum.TextXAlignment.Center
creditsLabel.TextYAlignment = Enum.TextYAlignment.Center
creditsLabel.Parent = mainFrame

--// Divider bawah Credits
local creditsDivider = Instance.new("Frame")
creditsDivider.Size = UDim2.new(1,0,0,1)
creditsDivider.Position = UDim2.new(0,0,0,60)
creditsDivider.BackgroundColor3 = Color3.fromRGB(200,200,200)
creditsDivider.BorderSizePixel = 0
creditsDivider.Parent = mainFrame

--// Scrolling Frame
local scrollingFrame = Instance.new("ScrollingFrame")
scrollingFrame.Size = UDim2.new(1,-20,0,160)
scrollingFrame.Position = UDim2.new(0,10,0,70)
scrollingFrame.BackgroundTransparency = 1
scrollingFrame.BorderSizePixel = 0
scrollingFrame.ScrollBarThickness = 6
scrollingFrame.Active = true
scrollingFrame.Selectable = false
scrollingFrame.Parent = mainFrame

local listLayout = Instance.new("UIListLayout")
listLayout.Padding = UDim.new(0,10)
listLayout.FillDirection = Enum.FillDirection.Horizontal
listLayout.HorizontalAlignment = Enum.HorizontalAlignment.Left
listLayout.VerticalAlignment = Enum.VerticalAlignment.Center
listLayout.Parent = scrollingFrame

--// Drag Scroll
local dragging = false
local dragStart = nil
local startPos = nil

scrollingFrame.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        dragging = true
        dragStart = input.Position
        startPos = scrollingFrame.CanvasPosition
        input.Changed:Connect(function()
            if input.UserInputState == Enum.UserInputState.End then
                dragging = false
            end
        end)
    end
end)

scrollingFrame.InputChanged:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseMovement and dragging then
        local delta = input.Position - dragStart
        scrollingFrame.CanvasPosition = Vector2.new(
            math.clamp(startPos.X - delta.X,0,scrollingFrame.CanvasSize.X.Offset - scrollingFrame.AbsoluteSize.X),
            0
        )
    end
end)

--// Apply Button
local applyBtn = Instance.new("TextButton")
applyBtn.Size = UDim2.new(0,160,0,36)
applyBtn.Position = UDim2.new(0.5,-80,1,-40)
applyBtn.Text = "Apply Selected"
applyBtn.Font = Enum.Font.GothamBold
applyBtn.TextSize = 18
applyBtn.TextColor3 = Color3.fromRGB(255,255,255)
applyBtn.BackgroundColor3 = Color3.fromRGB(0,150,255)
applyBtn.Parent = mainFrame

local applyUICorner = Instance.new("UICorner")
applyUICorner.CornerRadius = UDim.new(0,6)
applyUICorner.Parent = applyBtn

-- Hover animasi Apply
applyBtn.MouseEnter:Connect(function()
    TweenService:Create(applyBtn,TweenInfo.new(0.2,Enum.EasingStyle.Quad),{BackgroundColor3=Color3.fromRGB(0,180,255)}):Play()
end)
applyBtn.MouseLeave:Connect(function()
    TweenService:Create(applyBtn,TweenInfo.new(0.2,Enum.EasingStyle.Quad),{BackgroundColor3=Color3.fromRGB(0,150,255)}):Play()
end)

--// Shadow Toggle modern pill style
local shadowToggle = Instance.new("TextButton")
shadowToggle.Size = UDim2.new(0,160,0,36)
shadowToggle.Position = UDim2.new(0.5,-80,1,-80)
shadowToggle.BackgroundColor3 = Color3.fromRGB(80,80,80)
shadowToggle.Font = Enum.Font.GothamBold
shadowToggle.Text = "Shadow: On"
shadowToggle.TextSize = 16
shadowToggle.TextColor3 = Color3.fromRGB(255,255,255)
shadowToggle.Parent = mainFrame

local shadowUICorner = Instance.new("UICorner")
shadowUICorner.CornerRadius = UDim.new(0,18)
shadowUICorner.Parent = shadowToggle

-- Divider di atas Shadow
local shadowDivider = Instance.new("Frame")
shadowDivider.Size = UDim2.new(1,0,0,1)
shadowDivider.Position = UDim2.new(0,0,1,-90)
shadowDivider.BackgroundColor3 = Color3.fromRGB(200,200,200)
shadowDivider.BorderSizePixel = 0
shadowDivider.Parent = mainFrame

local shadowOn = true
local shadowTweenInfo = TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local shadowOnTween = TweenService:Create(shadowToggle, shadowTweenInfo, {BackgroundColor3 = Color3.fromRGB(0,150,255)})
local shadowOffTween = TweenService:Create(shadowToggle, shadowTweenInfo, {BackgroundColor3 = Color3.fromRGB(80,80,80)})

shadowToggle.MouseButton1Click:Connect(function()
    shadowOn = not shadowOn
    shadowToggle.Text = "Shadow: "..(shadowOn and "On" or "Off")
    if shadowOn then shadowOnTween:Play() else shadowOffTween:Play() end
end)

-- Hover animasi Shadow
shadowToggle.MouseEnter:Connect(function()
    TweenService:Create(shadowToggle,TweenInfo.new(0.2,Enum.EasingStyle.Quad),{BackgroundColor3=Color3.fromRGB(100,100,255)}):Play()
end)
shadowToggle.MouseLeave:Connect(function()
    if shadowOn then
        TweenService:Create(shadowToggle,TweenInfo.new(0.2,Enum.EasingStyle.Quad),{BackgroundColor3=Color3.fromRGB(0,150,255)}):Play()
    else
        TweenService:Create(shadowToggle,TweenInfo.new(0.2,Enum.EasingStyle.Quad),{BackgroundColor3=Color3.fromRGB(80,80,80)}):Play()
    end
end)

--// Sky Data
local selectedSky = nil

--// Get all Sky objects
local function getAllSkies()
    local skies = {}
    for _, obj in pairs(Lighting:GetChildren()) do
        if obj:IsA("Sky") then
            table.insert(skies, obj)
        end
    end
    return skies
end

--// Create Sky Button
local function createSkyButton(skyObj)
    local btn = Instance.new("Frame")
    btn.Size = UDim2.new(0,130,0,150)
    btn.BackgroundColor3 = Color3.fromRGB(50,50,50)
    btn.BorderSizePixel = 0
    btn.Parent = scrollingFrame

    local btnUICorner = Instance.new("UICorner")
    btnUICorner.CornerRadius = UDim.new(0,10)
    btnUICorner.Parent = btn

    -- Preview Image lebih kecil dari frame
    local img = Instance.new("ImageLabel")
    img.Size = UDim2.new(1,-20,0,100)
    img.Position = UDim2.new(0,10,0,10)
    img.BackgroundTransparency = 1
    img.Image = skyObj.SkyboxBk or ""
    img.Parent = btn

    -- Sky Name
    local nameLabel = Instance.new("TextLabel")
    nameLabel.Size = UDim2.new(1,-20,0,20)
    nameLabel.Position = UDim2.new(0,10,0,115)
    nameLabel.BackgroundTransparency = 1
    nameLabel.Text = skyObj.Name
    nameLabel.TextColor3 = Color3.fromRGB(255,255,255)
    nameLabel.Font = Enum.Font.Gotham
    nameLabel.TextSize = 16
    nameLabel.TextXAlignment = Enum.TextXAlignment.Center
    nameLabel.Parent = btn

    -- Selected sky glow
    local glow = Instance.new("UIStroke")
    glow.Thickness = 3
    glow.Color = Color3.fromRGB(50,150,255)
    glow.Transparency = 1
    glow.Parent = btn

    -- Hover effect
    local hoverTween = TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
    local hoverUp = TweenService:Create(img, hoverTween, {Size=UDim2.new(1,-20,0,110)})
    local hoverDown = TweenService:Create(img, hoverTween, {Size=UDim2.new(1,-20,0,100)})

    local clickBtn = Instance.new("TextButton")
    clickBtn.Size = UDim2.new(1,0,1,0)
    clickBtn.BackgroundTransparency = 1
    clickBtn.Text = ""
    clickBtn.Parent = btn

    clickBtn.MouseEnter:Connect(function()
        hoverUp:Play()
    end)
    clickBtn.MouseLeave:Connect(function()
        hoverDown:Play()
    end)
    clickBtn.MouseButton1Click:Connect(function()
        -- Reset semua glow
        for _, b in pairs(scrollingFrame:GetChildren()) do
            if b:IsA("Frame") and b:FindFirstChild("UIStroke") then
                b.UIStroke.Transparency = 1
            end
        end
        glow.Transparency = 0
        selectedSky = skyObj
    end)
end

-- Buat semua tombol Sky
for _, sky in pairs(getAllSkies()) do
    createSkyButton(sky)
end

-- Update CanvasSize
local function updateCanvasSize()
    scrollingFrame.CanvasSize = UDim2.new(0, listLayout.AbsoluteContentSize.X,0,0)
end
updateCanvasSize()
listLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(updateCanvasSize)

-- Apply Button
applyBtn.MouseButton1Click:Connect(function()
    if selectedSky then
        for _, obj in pairs(Lighting:GetChildren()) do
            if obj:IsA("Sky") then obj:Destroy() end
        end
        local newSky = selectedSky:Clone()
        newSky.Parent = Lighting
        newSky.Name = selectedSky.Name
    end
end)

-- Toggle Menu
toggleBtn.MouseButton1Click:Connect(function()
    mainFrame.Visible = not mainFrame.Visible
end)