import React, { useMemo, useState } from "react"; import { motion } from "framer-motion"; import { AlertTriangle, Blocks, Clipboard, Code2, Cpu, Flame, Gamepad2, Hammer, Rocket, ShieldCheck, Sparkles, Wrench, Zap, } from "lucide-react"; const crashCards = [ { title: "Loop of doom", danger: "A while true do with no wait is basically Studio's worst nightmare.", safeFix: "Put task.wait() in there and give the loop a way to stop.", icon: Cpu, }, { title: "Brick spam", danger: "Spawning 5,000 parts because it looked funny for one second will melt your session.", safeFix: "Cap the amount. Delete the leftovers. Your future self will thank you.", icon: Blocks, }, { title: "Physics soup", danger: "A pile of unanchored bricks colliding forever makes everything feel cursed.", safeFix: "Anchor test stuff, turn collisions off when you can, and clean the map.", icon: Hammer, }, { title: "Forgotten junk", danger: "Old connections, clones, and effects keep hanging around after you stop caring.", safeFix: "Destroy old objects and disconnect things when the round ends.", icon: Wrench, }, ]; const scriptTemplates = [ { name: "Flying Fireballs", tag: "click to shoot fire", code: `-- Flying Fireballs Tool Script -- Put this Script inside a Tool. The Tool should be in StarterPack. local tool = script.Parent local Debris = game:GetService("Debris") local COOLDOWN = 0.35 local SPEED = 95 local DAMAGE = 20 local lastShot = 0 tool.Activated:Connect(function() local now = os.clock() if now - lastShot < COOLDOWN then return end lastShot = now local character = tool.Parent local player = game.Players:GetPlayerFromCharacter(character) local root = character and character:FindFirstChild("HumanoidRootPart") if not player or not root then return end local fireball = Instance.new("Part") fireball.Name = "Fireball" fireball.Shape = Enum.PartType.Ball fireball.Size = Vector3.new(2.5, 2.5, 2.5) fireball.Material = Enum.Material.Neon fireball.Color = Color3.fromRGB(255, 85, 0) fireball.CanCollide = false fireball.CFrame = root.CFrame * CFrame.new(0, 0, -4) fireball.Parent = workspace local fire = Instance.new("Fire") fire.Heat = 12 fire.Size = 8 fire.Parent = fireball local velocity = Instance.new("BodyVelocity") velocity.MaxForce = Vector3.new(100000, 100000, 100000) velocity.Velocity = root.CFrame.LookVector * SPEED velocity.Parent = fireball local alreadyHit = false fireball.Touched:Connect(function(hit) if alreadyHit then return end if hit:IsDescendantOf(character) then return end local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid") if humanoid then alreadyHit = true humanoid:TakeDamage(DAMAGE) fireball:Destroy() end end) Debris:AddItem(fireball, 4) end)`, }, { name: "Bouncy Speed Pad", tag: "step on it and zoom", code: `-- Bouncy Speed Pad -- Put this Script inside a Part. local pad = script.Parent local BOOST_TIME = 2 local SPEED = 42 local JUMP = 80 pad.Touched:Connect(function(hit) local character = hit.Parent local humanoid = character and character:FindFirstChildOfClass("Humanoid") if not humanoid then return end local oldSpeed = humanoid.WalkSpeed local oldJump = humanoid.JumpPower humanoid.WalkSpeed = SPEED humanoid.JumpPower = JUMP humanoid.Jump = true task.wait(BOOST_TIME) if humanoid then humanoid.WalkSpeed = oldSpeed humanoid.JumpPower = oldJump end end)`, }, { name: "Tiny Explosion Button", tag: "dramatic but not insane", code: `-- Tiny Explosion Button -- Put this Script inside a ClickDetector's parent Part. local button = script.Parent local clickDetector = button:FindFirstChildOfClass("ClickDetector") if not clickDetector then clickDetector = Instance.new("ClickDetector") clickDetector.Parent = button end local busy = false clickDetector.MouseClick:Connect(function(player) if busy then return end busy = true local boom = Instance.new("Explosion") boom.Position = button.Position + Vector3.new(0, 5, 0) boom.BlastRadius = 8 boom.BlastPressure = 0 boom.Parent = workspace button.BrickColor = BrickColor.new("Really red") task.wait(1) button.BrickColor = BrickColor.new("Lime green") busy = false end)`, }, { name: "Fire Trail Boots", tag: "leaves fire crumbs", code: `-- Fire Trail Boots -- Put this Script in StarterCharacterScripts. local character = script.Parent local root = character:WaitForChild("HumanoidRootPart") local Debris = game:GetService("Debris") while character.Parent do local ember = Instance.new("Part") ember.Name = "FireTrail" ember.Anchored = true ember.CanCollide = false ember.Size = Vector3.new(1.5, 0.25, 1.5) ember.Material = Enum.Material.Neon ember.Color = Color3.fromRGB(255, 120, 0) ember.CFrame = root.CFrame * CFrame.new(0, -3, 0) ember.Parent = workspace local fire = Instance.new("Fire") fire.Size = 3 fire.Heat = 4 fire.Parent = ember Debris:AddItem(ember, 1.25) task.wait(0.18) end`, }, { name: "Panic Cleanup", tag: "delete the test mess", code: `-- Panic Cleanup -- Deletes old test objects with names used by these scripts. local namesToDelete = { Fireball = true, FireTrail = true, TestPart = true, } local deleted = 0 for _, item in workspace:GetDescendants() do if namesToDelete[item.Name] or item.Name:match("^TestPart") then item:Destroy() deleted += 1 end end print("Cleaned up", deleted, "test things.")`, }, ]; const navItems = ["Home", "Crash Log", "Scripts", "Rules"]; function PixelButton({ children, href }: { children: React.ReactNode; href: string }) { return ( {children} ); } export default function StudioCrashersWebsite() { const [activeTemplate, setActiveTemplate] = useState(0); const [copied, setCopied] = useState(false); const activeCode = useMemo(() => scriptTemplates[activeTemplate].code, [activeTemplate]); async function copyCode() { try { await navigator.clipboard.writeText(activeCode); setCopied(true); window.setTimeout(() => setCopied(false), 1200); } catch { setCopied(false); } } return (
); }