local Players = game:GetService("Players") local player = Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() player.CharacterAdded:Connect(function(c) character = c end) local function createGui() local old = player.PlayerGui:FindFirstChild("ModelInserter") if old then old:Destroy() end local gui = Instance.new("ScreenGui") gui.Name = "ModelInserter" gui.ResetOnSpawn = false gui.Parent = player:WaitForChild("PlayerGui") local frame = Instance.new("Frame") frame.Size = UDim2.new(0,360,0,210) frame.Position = UDim2.new(0.5,-180,0.5,-105) frame.BackgroundColor3 = Color3.fromRGB(20,20,30) frame.Parent = gui frame.Active = true frame.Draggable = true local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0,18) corner.Parent = frame local title = Instance.new("TextLabel") title.Size = UDim2.new(1,0,0,40) title.BackgroundTransparency = 1 title.Text = "Model Inserter" title.Font = Enum.Font.GothamBold title.TextSize = 20 title.TextColor3 = Color3.new(1,1,1) title.Parent = frame local hideBtn = Instance.new("TextButton") hideBtn.Size = UDim2.new(0,35,0,35) hideBtn.Position = UDim2.new(1,-40,0,2) hideBtn.Text = "-" hideBtn.Font = Enum.Font.GothamBold hideBtn.TextSize = 18 hideBtn.BackgroundTransparency = 1 hideBtn.TextColor3 = Color3.new(1,1,1) hideBtn.Parent = frame local input = Instance.new("TextBox") input.Size = UDim2.new(1,-30,0,40) input.Position = UDim2.new(0,15,0,55) input.PlaceholderText = "Enter Asset ID" input.Text = "" input.Font = Enum.Font.Gotham input.TextSize = 16 input.TextColor3 = Color3.new(1,1,1) input.BackgroundColor3 = Color3.fromRGB(35,35,45) input.Parent = frame local inputCorner = Instance.new("UICorner") inputCorner.CornerRadius = UDim.new(0,12) inputCorner.Parent = input local insertBtn = Instance.new("TextButton") insertBtn.Size = UDim2.new(1,-30,0,40) insertBtn.Position = UDim2.new(0,15,0,105) insertBtn.Text = "Insert Model" insertBtn.Font = Enum.Font.GothamBold insertBtn.TextSize = 17 insertBtn.TextColor3 = Color3.new(1,1,1) insertBtn.BackgroundColor3 = Color3.fromRGB(0,140,255) insertBtn.Parent = frame local btnCorner = Instance.new("UICorner") btnCorner.CornerRadius = UDim.new(0,12) btnCorner.Parent = insertBtn local tpSpawnBtn = Instance.new("TextButton") tpSpawnBtn.Size = UDim2.new(0.5,-20,0,35) tpSpawnBtn.Position = UDim2.new(0,15,0,155) tpSpawnBtn.Text = "TP Spawn" tpSpawnBtn.Font = Enum.Font.GothamBold tpSpawnBtn.TextSize = 14 tpSpawnBtn.TextColor3 = Color3.new(1,1,1) tpSpawnBtn.BackgroundColor3 = Color3.fromRGB(0,200,120) tpSpawnBtn.Parent = frame local tpCenterBtn = Instance.new("TextButton") tpCenterBtn.Size = UDim2.new(0.5,-20,0,35) tpCenterBtn.Position = UDim2.new(0.5,5,0,155) tpCenterBtn.Text = "TP Center" tpCenterBtn.Font = Enum.Font.GothamBold tpCenterBtn.TextSize = 14 tpCenterBtn.TextColor3 = Color3.new(1,1,1) tpCenterBtn.BackgroundColor3 = Color3.fromRGB(200,120,0) tpCenterBtn.Parent = frame local hidden = false hideBtn.MouseButton1Click:Connect(function() hidden = not hidden input.Visible = not hidden insertBtn.Visible = not hidden tpSpawnBtn.Visible = not hidden tpCenterBtn.Visible = not hidden frame.Size = hidden and UDim2.new(0,360,0,40) or UDim2.new(0,360,0,210) end) return input, insertBtn, tpSpawnBtn, tpCenterBtn end local function getExtremelyFarPosition() return Vector3.new( math.random(2000000,3000000), math.random(800000,1200000), math.random(2000000,3000000) ) end local function getAllParts(container) local parts = {} for _,v in pairs(container:GetDescendants()) do if v:IsA("BasePart") then table.insert(parts,v) end end return parts end local function removeInvisibleParts(container) for _,v in pairs(container:GetDescendants()) do if v:IsA("BasePart") and v.Transparency >= 1 then v:Destroy() end end end local function getCenterPart(container) local parts = getAllParts(container) if #parts == 0 then return nil end local total = Vector3.zero for _,p in pairs(parts) do total += p.Position end local center = total / #parts local closest = parts[1] local dist = (closest.Position - center).Magnitude for _,p in pairs(parts) do local d = (p.Position - center).Magnitude if d < dist then closest = p dist = d end end return closest end local function getSpawnPart(container) for _,v in pairs(container:GetDescendants()) do if v:IsA("BasePart") and string.find(string.lower(v.Name),"spawn") then return v end end return nil end local currentModel = nil local function prepareModel(model, position) removeInvisibleParts(model) for _,v in pairs(model:GetDescendants()) do if v:IsA("BasePart") then v.Anchored = true v.CanCollide = true v.Transparency = 0 end end if model:IsA("Model") then model:PivotTo(CFrame.new(position)) end end local function insertModel(assetId) local id = tonumber(assetId) if not id then return end local success, objects = pcall(function() return game:GetObjects("rbxassetid://"..id) end) if not success or not objects or #objects == 0 then return end local model = objects[1] model.Parent = workspace local farPos = getExtremelyFarPosition() prepareModel(model, farPos) currentModel = model end local function teleportTo(part) if character and character:FindFirstChild("HumanoidRootPart") and part then character.HumanoidRootPart.CFrame = part.CFrame + Vector3.new(0,5,0) end end local inputBox, insertButton, tpSpawnBtn, tpCenterBtn = createGui() insertButton.MouseButton1Click:Connect(function() insertModel(inputBox.Text) end) tpSpawnBtn.MouseButton1Click:Connect(function() if currentModel then local spawn = getSpawnPart(currentModel) if spawn then teleportTo(spawn) end end end) tpCenterBtn.MouseButton1Click:Connect(function() if currentModel then local centerPart = getCenterPart(currentModel) if centerPart then teleportTo(centerPart) end end end)