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 currentModel = nil local guiVisible = true local function getSafePosition() local parts = {} for _,v in pairs(workspace:GetDescendants()) do if v:IsA("BasePart") then table.insert(parts,v) end end local spawnPart = nil for _,v in pairs(workspace:GetDescendants()) do if v:IsA("BasePart") and string.find(string.lower(v.Name),"spawn") then spawnPart = v break end end local spawnPos = spawnPart and spawnPart.Position or Vector3.zero local center = Vector3.zero if #parts > 0 then for _,p in pairs(parts) do center += p.Position end center = center / #parts end local mid = (spawnPos + center) / 2 local safeOffset = Vector3.new( math.random(50000,60000), math.random(20000,30000), math.random(50000,60000) ) return mid + safeOffset end local function getExtremelyFarPosition() return getSafePosition() 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 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 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 function prepareModel(model, position) for _,v in pairs(model:GetDescendants()) do if v:IsA("BasePart") then v.Anchored = true v.CanCollide = true 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 prepareModel(model, getExtremelyFarPosition()) currentModel = model end local function toggleGui(frame, toggleBtn, contentFrame) guiVisible = not guiVisible contentFrame.Visible = guiVisible if guiVisible then frame.Size = UDim2.new(0,380,0,220) toggleBtn.Text = "-" else frame.Size = UDim2.new(0,380,0,40) toggleBtn.Text = "+" end 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,380,0,220) frame.Position = UDim2.new(0.5,-190,0.5,-110) frame.BackgroundColor3 = Color3.fromRGB(15,15,15) frame.Parent = gui frame.Active = true frame.Draggable = true Instance.new("UICorner", frame).CornerRadius = UDim.new(0,18) local title = Instance.new("TextLabel") title.Size = UDim2.new(1,0,0,40) title.BackgroundColor3 = Color3.fromRGB(35,35,35) title.Text = "Model Inserter" title.Font = Enum.Font.GothamBold title.TextSize = 18 title.TextColor3 = Color3.new(1,1,1) title.Parent = frame Instance.new("UICorner", title).CornerRadius = UDim.new(0,18) local toggleBtn = Instance.new("TextButton") toggleBtn.Size = UDim2.new(0,35,0,35) toggleBtn.Position = UDim2.new(0,5,0,2) toggleBtn.Text = "-" toggleBtn.BackgroundColor3 = Color3.fromRGB(60,60,60) toggleBtn.TextColor3 = Color3.new(1,1,1) toggleBtn.Font = Enum.Font.GothamBold toggleBtn.TextSize = 18 toggleBtn.Parent = frame Instance.new("UICorner", toggleBtn).CornerRadius = UDim.new(1,0) local destroyBtn = Instance.new("TextButton") destroyBtn.Size = UDim2.new(0,35,0,35) destroyBtn.Position = UDim2.new(0,45,0,2) destroyBtn.Text = "X" destroyBtn.Font = Enum.Font.GothamBold destroyBtn.TextSize = 18 destroyBtn.BackgroundColor3 = Color3.fromRGB(200,0,0) destroyBtn.TextColor3 = Color3.new(1,1,1) destroyBtn.Parent = frame Instance.new("UICorner", destroyBtn).CornerRadius = UDim.new(1,0) local contentFrame = Instance.new("Frame") contentFrame.Size = UDim2.new(1,0,1,-40) contentFrame.Position = UDim2.new(0,0,0,40) contentFrame.BackgroundTransparency = 1 contentFrame.Parent = frame local input = Instance.new("TextBox") input.Size = UDim2.new(1,-30,0,40) input.Position = UDim2.new(0,15,0,20) input.PlaceholderText = "Enter Asset ID" input.BackgroundColor3 = Color3.fromRGB(40,40,40) input.TextColor3 = Color3.new(1,1,1) input.Font = Enum.Font.Gotham input.TextSize = 16 input.Parent = contentFrame Instance.new("UICorner", input).CornerRadius = UDim.new(0,12) local insertBtn = Instance.new("TextButton") insertBtn.Size = UDim2.new(1,-30,0,40) insertBtn.Position = UDim2.new(0,15,0,70) insertBtn.Text = "Insert Model" insertBtn.BackgroundColor3 = Color3.fromRGB(60,60,60) insertBtn.TextColor3 = Color3.new(1,1,1) insertBtn.Font = Enum.Font.GothamBold insertBtn.TextSize = 16 insertBtn.Parent = contentFrame Instance.new("UICorner", insertBtn).CornerRadius = UDim.new(0,12) local tpSpawnBtn = Instance.new("TextButton") tpSpawnBtn.Size = UDim2.new(0.5,-20,0,35) tpSpawnBtn.Position = UDim2.new(0,15,0,120) tpSpawnBtn.Text = "TP Spawn" tpSpawnBtn.BackgroundColor3 = Color3.fromRGB(0,100,255) tpSpawnBtn.TextColor3 = Color3.new(1,1,1) tpSpawnBtn.Font = Enum.Font.GothamBold tpSpawnBtn.TextSize = 14 tpSpawnBtn.Parent = contentFrame Instance.new("UICorner", tpSpawnBtn).CornerRadius = UDim.new(0,12) local tpCenterBtn = Instance.new("TextButton") tpCenterBtn.Size = UDim2.new(0.5,-20,0,35) tpCenterBtn.Position = UDim2.new(0.5,5,0,120) tpCenterBtn.Text = "TP Center" tpCenterBtn.BackgroundColor3 = Color3.fromRGB(255,200,0) tpCenterBtn.TextColor3 = Color3.new(0,0,0) tpCenterBtn.Font = Enum.Font.GothamBold tpCenterBtn.TextSize = 14 tpCenterBtn.Parent = contentFrame Instance.new("UICorner", tpCenterBtn).CornerRadius = UDim.new(0,12) local confirmFrame = Instance.new("Frame") confirmFrame.Size = UDim2.new(0,380,0,110) confirmFrame.Position = UDim2.new(0.5,-190,0.5,120) confirmFrame.BackgroundColor3 = Color3.fromRGB(255,255,255) confirmFrame.Visible = false confirmFrame.Parent = gui Instance.new("UICorner", confirmFrame).CornerRadius = UDim.new(0,18) local confirmText = Instance.new("TextLabel") confirmText.Size = UDim2.new(1,0,0,50) confirmText.BackgroundTransparency = 1 confirmText.Text = "Are you sure to destroy model?" confirmText.TextColor3 = Color3.new(0,0,0) confirmText.Font = Enum.Font.GothamBold confirmText.TextSize = 16 confirmText.Parent = confirmFrame local yesBtn = Instance.new("TextButton") yesBtn.Size = UDim2.new(0.5,-10,0,40) yesBtn.Position = UDim2.new(0,5,0,60) yesBtn.Text = "Yes" yesBtn.BackgroundColor3 = Color3.fromRGB(0,200,0) yesBtn.TextColor3 = Color3.new(1,1,1) yesBtn.Font = Enum.Font.GothamBold yesBtn.Parent = confirmFrame Instance.new("UICorner", yesBtn).CornerRadius = UDim.new(0,12) local noBtn = Instance.new("TextButton") noBtn.Size = UDim2.new(0.5,-10,0,40) noBtn.Position = UDim2.new(0.5,5,0,60) noBtn.Text = "No" noBtn.BackgroundColor3 = Color3.fromRGB(200,0,0) noBtn.TextColor3 = Color3.new(1,1,1) noBtn.Font = Enum.Font.GothamBold noBtn.Parent = confirmFrame Instance.new("UICorner", noBtn).CornerRadius = UDim.new(0,12) toggleBtn.MouseButton1Click:Connect(function() toggleGui(frame, toggleBtn, contentFrame) end) insertBtn.MouseButton1Click:Connect(function() insertModel(input.Text) end) destroyBtn.MouseButton1Click:Connect(function() if currentModel then confirmFrame.Visible = true end end) yesBtn.MouseButton1Click:Connect(function() if currentModel then currentModel:Destroy() currentModel = nil end confirmFrame.Visible = false end) noBtn.MouseButton1Click:Connect(function() confirmFrame.Visible = false 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 center = getCenterPart(currentModel) if center then teleportTo(center) end end end) end createGui()