diff --git a/.changeset/server-island-slot-scripts.md b/.changeset/server-island-slot-scripts.md
new file mode 100644
index 000000000000..3066706588e2
--- /dev/null
+++ b/.changeset/server-island-slot-scripts.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Fixes a case where `
diff --git a/packages/astro/test/fixtures/server-islands/ssr/src/components/Wrapper.astro b/packages/astro/test/fixtures/server-islands/ssr/src/components/Wrapper.astro
new file mode 100644
index 000000000000..f4c3cfc62527
--- /dev/null
+++ b/packages/astro/test/fixtures/server-islands/ssr/src/components/Wrapper.astro
@@ -0,0 +1,5 @@
+---
+---
+
+
+
diff --git a/packages/astro/test/fixtures/server-islands/ssr/src/pages/slot-with-script.astro b/packages/astro/test/fixtures/server-islands/ssr/src/pages/slot-with-script.astro
new file mode 100644
index 000000000000..2db634722b90
--- /dev/null
+++ b/packages/astro/test/fixtures/server-islands/ssr/src/pages/slot-with-script.astro
@@ -0,0 +1,15 @@
+---
+import Wrapper from '../components/Wrapper.astro';
+import ScriptedCounter from '../components/ScriptedCounter.astro';
+---
+
+
+ Slot with script
+
+
+
+
+ Loading...
+
+
+
diff --git a/packages/astro/test/server-islands.test.js b/packages/astro/test/server-islands.test.js
index 330441add0c1..dfcaf8931e53 100644
--- a/packages/astro/test/server-islands.test.js
+++ b/packages/astro/test/server-islands.test.js
@@ -245,6 +245,20 @@ describe('Server islands', () => {
assert.equal(fetchMatch.length, 2, 'should include props in the query string');
assert.equal(fetchMatch[1], '', 'should not include encrypted empty props');
});
+
+ it('includes script from slotted component in island response', async () => {
+ const res = await fixture.fetch('/slot-with-script');
+ assert.equal(res.status, 200);
+ const html = await res.text();
+ // Extract the island fetch URL from the page
+ const urlMatch = html.match(/fetch\('(\/_server-islands\/Wrapper\?[^']+)'/);
+ assert.ok(urlMatch, 'should have a server island fetch URL');
+ const islandRes = await fixture.fetch(urlMatch[1]);
+ assert.equal(islandRes.status, 200);
+ const islandHtml = await islandRes.text();
+ assert.ok(islandHtml.includes('