Tt

--// SC.lua
--// PEEXHUB VISUAL PET SYSTEM
--// CLIENT ONLY | SAFE | FULL MERGED | NO BLOCK | NO ROTATE

--------------------------------------------------
-- SERVICES
--------------------------------------------------
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local UIS = game:GetService("UserInputService")
local PhysicsService = game:GetService("PhysicsService")

local player = Players.LocalPlayer
local gui = Instance.new("ScreenGui", player.PlayerGui)
gui.Name = "PeexHubGUI"
gui.ResetOnSpawn = false

--------------------------------------------------
-- COLLISION FIX (NO BLOCK)
--------------------------------------------------
pcall(function()
    PhysicsService:CreateCollisionGroup("VisualPet")
end)
PhysicsService:CollisionGroupSetCollidable("VisualPet","Default",false)
PhysicsService:CollisionGroupSetCollidable("VisualPet","VisualPet",false)

--------------------------------------------------
-- UTIL
--------------------------------------------------
local function corner(o,r)
    Instance.new("UICorner",o).CornerRadius = UDim.new(0,r)
end

--------------------------------------------------
-- SPLASH
--------------------------------------------------
local splash = Instance.new("Frame",gui)
splash.Size = UDim2.fromOffset(240,140)
splash.Position = UDim2.fromScale(0.5,0.45)
splash.AnchorPoint = Vector2.new(0.5,0.5)
splash.BackgroundColor3 = Color3.fromRGB(15,18,26)
corner(splash,16)

local logo = Instance.new("ImageLabel",splash)
logo.Image = "rbxassetid://7229442422"
logo.Size = UDim2.fromOffset(64,64)
logo.Position = UDim2.fromScale(0.5,-0.4)
logo.AnchorPoint = Vector2.new(0.5,0.5)
logo.BackgroundTransparency = 1

local text = Instance.new("TextLabel",splash)
text.Text = "PeexHub"
text.Font = Enum.Font.GothamBlack
text.TextSize = 18
text.Position = UDim2.fromScale(0.5,0.75)
text.AnchorPoint = Vector2.new(0.5,0.5)
text.BackgroundTransparency = 1
text.TextColor3 = Color3.new(1,1,1)

TweenService:Create(logo,TweenInfo.new(0.9,Enum.EasingStyle.Bounce),{
    Position = UDim2.fromScale(0.5,0.35)
}):Play()

task.spawn(function()
    local h=0
    while splash.Parent do
        h=(h+2)%360
        text.TextColor3 = Color3.fromHSV(h/360,1,1)
        task.wait(0.04)
    end
end)

task.wait(1.3)
splash:Destroy()

--------------------------------------------------
-- MAIN GUI
--------------------------------------------------
local main = Instance.new("Frame",gui)
main.Size = UDim2.fromOffset(520,300)
main.Position = UDim2.fromScale(0.5,0.5)
main.AnchorPoint = Vector2.new(0.5,0.5)
main.BackgroundColor3 = Color3.fromRGB(18,22,30)
corner(main,18)

local header = Instance.new("Frame",main)
header.Size = UDim2.new(1,0,0,40)
header.BackgroundTransparency = 1

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

--------------------------------------------------
-- DRAG (WORKING)
--------------------------------------------------
do
    local dragging, start, startPos
    header.InputBegan:Connect(function(i)
        if i.UserInputType==Enum.UserInputType.MouseButton1 or i.UserInputType==Enum.UserInputType.Touch then
            dragging=true
            start=i.Position
            startPos=main.Position
        end
    end)
    UIS.InputChanged:Connect(function(i)
        if dragging then
            if i.UserInputType==Enum.UserInputType.MouseMovement or i.UserInputType==Enum.UserInputType.Touch 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
    end)
    UIS.InputEnded:Connect(function(i)
        if i.UserInputType==Enum.UserInputType.MouseButton1 or i.UserInputType==Enum.UserInputType.Touch then
            dragging=false
        end
    end)
end

--------------------------------------------------
-- VISUAL INVENTORY (CLIENT)
--------------------------------------------------
local backpack = player:WaitForChild("Backpack")
local visualInventory = Instance.new("Folder", backpack)
visualInventory.Name = "VisualInventory"

--------------------------------------------------
-- DETECT ALL PET MODELS IN GAME
--------------------------------------------------
local CachedPets = {}

local function scanPets()
    table.clear(CachedPets)
    for _,v in ipairs(game:GetDescendants()) do
        if v:IsA("Model") and v:FindFirstChildWhichIsA("BasePart") then
            CachedPets[v.Name] = v
        end
    end
end
scanPets()

--------------------------------------------------
-- VISUAL PET SYSTEM
--------------------------------------------------
local VisualPets = {}

local function prepareParts(model)
    for _,p in ipairs(model:GetDescendants()) do
        if p:IsA("BasePart") then
            p.CanCollide=false
            p.CanQuery=false
            p.CanTouch=false
            p.Massless=true
            PhysicsService:SetPartCollisionGroup(p,"VisualPet")
        end
    end
end

local function spawnPet(name, mutation)
    local src = CachedPets[name]
    if not src then return end

    local pet = src:Clone()
    pet.Name = name.."_VISUAL"
    pet.Parent = workspace
    pet.PrimaryPart = pet.PrimaryPart or pet:FindFirstChildWhichIsA("BasePart")

    prepareParts(pet)

    if mutation=="Golden" then
        for _,p in ipairs(pet:GetDescendants()) do
            if p:IsA("BasePart") then
                p.Material=Enum.Material.Metal
                p.Color=Color3.fromRGB(255,215,0)
            end
        end
    elseif mutation=="Rainbow" then
        task.spawn(function()
            while pet.Parent do
                for _,p in ipairs(pet:GetDescendants()) do
                    if p:IsA("BasePart") then
                        p.Material=Enum.Material.Neon
                        p.Color=Color3.fromHSV((tick()*0.2)%1,1,1)
                    end
                end
                task.wait(0.05)
            end
        end)
    end

    -- VISUAL INVENTORY ENTRY
    local tag = Instance.new("StringValue")
    tag.Name = name
    tag.Value = "VisualPet"
    tag.Parent = visualInventory

    table.insert(VisualPets,pet)
end

--------------------------------------------------
-- FOLLOW PLAYER (NO ROTATE)
--------------------------------------------------
RunService.RenderStepped:Connect(function()
    local char=player.Character
    local hrp=char and char:FindFirstChild("HumanoidRootPart")
    if not hrp then return end

    for i,pet in ipairs(VisualPets) do
        if pet.PrimaryPart then
            pet:PivotTo(
                hrp.CFrame * CFrame.new((i-1)*1.8,1.5,-2)
            )
        end
    end
end)

--------------------------------------------------
-- SIMPLE UI LIST (AUTO FROM DETECTED PETS)
--------------------------------------------------
local list = Instance.new("ScrollingFrame",main)
list.Position = UDim2.fromOffset(12,48)
list.Size = UDim2.new(1,-24,1,-60)
list.AutomaticCanvasSize = Enum.AutomaticSize.Y
list.CanvasSize = UDim2.new(0,0,0,0)
list.ScrollBarImageTransparency = 0.6
list.BackgroundTransparency = 1

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

for name,_ in pairs(CachedPets) do
    local btn = Instance.new("TextButton",list)
    btn.Text = "VISUAL "..name
    btn.Size = UDim2.new(1,0,0,36)
    btn.BackgroundColor3 = Color3.fromRGB(40,50,70)
    btn.TextColor3 = Color3.new(1,1,1)
    btn.Font = Enum.Font.GothamBold
    btn.TextSize = 13
    corner(btn,10)

    btn.MouseButton1Click:Connect(function()
        spawnPet(name,"")
    end)
end

Views: 60

Created At: 2025-12-29 10:45:20

View Raw Download Clone