Tddh

--// VISUAL PET SIMULATOR - CLIENT ONLY
--// Aman | Tidak kirim data ke server

local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local UIS = game:GetService("UserInputService")
local player = Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")

-- CLEAN OLD
pcall(function()
    PlayerGui:FindFirstChild("VisualPetGUI"):Destroy()
end)

-- GUI ROOT
local gui = Instance.new("ScreenGui", PlayerGui)
gui.Name = "VisualPetGUI"
gui.ResetOnSpawn = false

-- MAIN FRAME
local main = Instance.new("Frame", gui)
main.Size = UDim2.fromScale(0.35, 0.45)
main.Position = UDim2.fromScale(0.5, -0.6)
main.AnchorPoint = Vector2.new(0.5, 0)
main.BackgroundColor3 = Color3.fromRGB(20,20,25)
main.BorderSizePixel = 0
main.ClipsDescendants = true
main.Name = "Main"

Instance.new("UICorner", main).CornerRadius = UDim.new(0,18)

-- EXECUTE ANIMATION
TweenService:Create(main, TweenInfo.new(0.8, Enum.EasingStyle.Quint), {
    Position = UDim2.fromScale(0.5, 0.25)
}):Play()

-- HEADER
local header = Instance.new("Frame", main)
header.Size = UDim2.fromScale(1, 0.12)
header.BackgroundColor3 = Color3.fromRGB(28,28,35)
header.BorderSizePixel = 0

Instance.new("UICorner", header).CornerRadius = UDim.new(0,18)

local title = Instance.new("TextLabel", header)
title.Size = UDim2.fromScale(1,1)
title.BackgroundTransparency = 1
title.Text = "Visual Pet Simulator"
title.TextColor3 = Color3.fromRGB(230,230,255)
title.Font = Enum.Font.GothamBold
title.TextSize = 18

-- BUTTONS
local function headerBtn(text, pos)
    local b = Instance.new("TextButton", header)
    b.Size = UDim2.fromScale(0.08,0.6)
    b.Position = pos
    b.Text = text
    b.Font = Enum.Font.GothamBold
    b.TextSize = 14
    b.BackgroundColor3 = Color3.fromRGB(45,45,60)
    b.TextColor3 = Color3.new(1,1,1)
    Instance.new("UICorner", b).CornerRadius = UDim.new(0,8)
    return b
end

local close = headerBtn("X", UDim2.fromScale(0.9,0.2))
local mini  = headerBtn("-", UDim2.fromScale(0.81,0.2))

close.MouseButton1Click:Connect(function()
    gui:Destroy()
end)

local minimized = false
mini.MouseButton1Click:Connect(function()
    minimized = not minimized
    TweenService:Create(main, TweenInfo.new(0.4), {
        Size = minimized and UDim2.fromScale(0.35,0.12) or UDim2.fromScale(0.35,0.45)
    }):Play()
end)

-- DRAG
do
    local drag, start, startPos
    header.InputBegan:Connect(function(i)
        if i.UserInputType == Enum.UserInputType.MouseButton1 then
            drag = true
            start = i.Position
            startPos = main.Position
        end
    end)
    UIS.InputChanged:Connect(function(i)
        if drag and i.UserInputType == Enum.UserInputType.MouseMovement then
            local delta = i.Position - start
            main.Position = UDim2.new(
                startPos.X.Scale,
                startPos.X.Offset + delta.X,
                startPos.Y.Scale,
                startPos.Y.Offset + delta.Y
            )
        end
    end)
    UIS.InputEnded:Connect(function(i)
        if i.UserInputType == Enum.UserInputType.MouseButton1 then
            drag = false
        end
    end)
end

-- CONTENT
local list = Instance.new("ScrollingFrame", main)
list.Position = UDim2.fromScale(0.05,0.15)
list.Size = UDim2.fromScale(0.9,0.7)
list.CanvasSize = UDim2.new(0,0,0,0)
list.ScrollBarImageTransparency = 0.6
list.AutomaticCanvasSize = Enum.AutomaticSize.Y
list.BackgroundTransparency = 1

local layout = Instance.new("UIListLayout", list)
layout.Padding = UDim.new(0,12)

-- PET DATA
local pets = {
    "Frost Spirit",
    "Gilded Seraphin",
    "Christmas Tree"
}

local spawned = {}

-- FIND PET MODEL CLIENT SIDE
local function findPetModel(name)
    for _,v in pairs(game:GetDescendants()) do
        if v:IsA("Model") and v.Name == name then
            return v
        end
    end
end

-- SPAWN VISUAL
local function spawnVisual(petName, amount)
    local model = findPetModel(petName)
    if not model then return end

    for i = 1, amount do
        local c = model:Clone()
        c.Name = petName .. "_VISUAL_" .. i
        c.Parent = workspace
        c:PivotTo(player.Character.HumanoidRootPart.CFrame * CFrame.new(math.random(-4,4),0,math.random(-4,4)))
        table.insert(spawned, c)
    end
end

-- DELETE ALL
local function clearAll()
    for _,v in ipairs(spawned) do
        pcall(function() v:Destroy() end)
    end
    table.clear(spawned)
end

-- PET UI
for _,pet in ipairs(pets) do
    local card = Instance.new("Frame", list)
    card.Size = UDim2.fromScale(1,0.22)
    card.BackgroundColor3 = Color3.fromRGB(30,30,40)
    Instance.new("UICorner", card).CornerRadius = UDim.new(0,14)

    local name = Instance.new("TextLabel", card)
    name.Size = UDim2.fromScale(1,0.4)
    name.BackgroundTransparency = 1
    name.Text = pet
    name.Font = Enum.Font.GothamBold
    name.TextSize = 16
    name.TextColor3 = Color3.fromRGB(200,220,255)

    local box = Instance.new("TextBox", card)
    box.PlaceholderText = "Jumlah Pet"
    box.Size = UDim2.fromScale(0.6,0.3)
    box.Position = UDim2.fromScale(0.05,0.5)
    box.BackgroundColor3 = Color3.fromRGB(45,45,60)
    box.TextColor3 = Color3.new(1,1,1)
    box.Font = Enum.Font.Gotham
    box.TextSize = 14
    Instance.new("UICorner", box).CornerRadius = UDim.new(0,10)

    local go = Instance.new("TextButton", card)
    go.Text = "START GAS"
    go.Size = UDim2.fromScale(0.25,0.3)
    go.Position = UDim2.fromScale(0.7,0.5)
    go.BackgroundColor3 = Color3.fromRGB(80,120,255)
    go.TextColor3 = Color3.new(1,1,1)
    go.Font = Enum.Font.GothamBold
    go.TextSize = 14
    Instance.new("UICorner", go).CornerRadius = UDim.new(0,10)

    go.MouseButton1Click:Connect(function()
        local n = tonumber(box.Text)
        if n and n > 0 then
            spawnVisual(pet, math.clamp(n,1,50))
        end
    end)
end

-- DELETE BUTTON
local del = Instance.new("TextButton", main)
del.Text = "DELETE ALL VISUAL"
del.Size = UDim2.fromScale(0.6,0.1)
del.Position = UDim2.fromScale(0.2,0.88)
del.BackgroundColor3 = Color3.fromRGB(200,60,60)
del.TextColor3 = Color3.new(1,1,1)
del.Font = Enum.Font.GothamBold
del.TextSize = 14
Instance.new("UICorner", del).CornerRadius = UDim.new(0,12)

del.MouseButton1Click:Connect(clearAll)

Views: 55

Created At: 2025-12-29 09:46:44

View Raw Download Clone