Tt

--// SC.lua
--// PEEXHUB VISUAL PET - CLIENT ONLY
--// FIXED RUN | NO BLOCK | NO ROTATE | FOLLOW STATIC | VISUAL INVENTORY

--------------------------------------------------
-- 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 PlayerGui = player:WaitForChild("PlayerGui")

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

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

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

--------------------------------------------------
-- UTIL
--------------------------------------------------
local function corner(o,r)
    local c = Instance.new("UICorner")
    c.CornerRadius = UDim.new(0,r)
    c.Parent = o
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.2)
splash:Destroy()

--------------------------------------------------
-- MAIN WINDOW
--------------------------------------------------
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 (MOUSE + TOUCH)
--------------------------------------------------
do
    local dragging=false
    local startPos, startInput
    header.InputBegan:Connect(function(i)
        if i.UserInputType==Enum.UserInputType.MouseButton1 or i.UserInputType==Enum.UserInputType.Touch then
            dragging=true
            startInput=i.Position
            startPos=main.Position
        end
    end)
    UIS.InputChanged:Connect(function(i)
        if dragging and (i.UserInputType==Enum.UserInputType.MouseMovement or i.UserInputType==Enum.UserInputType.Touch) then
            local delta=i.Position-startInput
            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 or i.UserInputType==Enum.UserInputType.Touch then
            dragging=false
        end
    end)
end

--------------------------------------------------
-- VISUAL INVENTORY (CLIENT)
--------------------------------------------------
local backpack = player:WaitForChild("Backpack")
pcall(function()
    backpack:FindFirstChild("VisualInventory"):Destroy()
end)

local visualInventory = Instance.new("Folder")
visualInventory.Name = "VisualInventory"
visualInventory.Parent = backpack

--------------------------------------------------
-- SCAN ALL PET MODELS (SAFE)
--------------------------------------------------
local CachedPets = {}

local function scanPets()
    table.clear(CachedPets)
    for _,v in ipairs(game:GetDescendants()) do
        if v:IsA("Model") then
            local bp = v:FindFirstChildWhichIsA("BasePart")
            if bp then
                CachedPets[v.Name] = v
            end
        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
            p.Anchored=false
            p.AssemblyLinearVelocity=Vector3.zero
            p.AssemblyAngularVelocity=Vector3.zero
            pcall(function()
                PhysicsService:SetPartCollisionGroup(p,"VisualPet")
            end)
        end
    end
end

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

    local pet = src:Clone()
    pet.Name = petName.."_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.25)%1,1,1)
                    end
                end
                task.wait(0.05)
            end
        end)
    end

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

    table.insert(VisualPets, pet)
end

--------------------------------------------------
-- FOLLOW PLAYER (STATIC, 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
            local offset = CFrame.new((i-1)*1.8,1.5,-2)
            pet:PivotTo(hrp.CFrame * offset)
        end
    end
end)

--------------------------------------------------
-- 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)

-- BUTTONS
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: 62

Created At: 2025-12-29 10:55:56

View Raw Download Clone