JVDesignStudio

🔍 Bug Hunter's Guide

EmberEmber says: every bug is a clue. Read the message and it tells you what to fix.

EchoEcho says: found the fix? Change one thing and run it again, so you know the bug has really gone.

When your code doesn't work, don't panic! Use this guide to track down and squash every bug. Pick your engine, find your error, and follow the fix.

🔍
🐱
Scratch 4 Errors
🐛 Sprite Not Moving
❌ Problem
You added a "move 10 steps" block but nothing happens when you click the green flag. The sprite stays in the same place.
✅ Solution
  1. Make sure you have a when green flag clicked block on top.
  2. Wrap your move block inside a forever loop , otherwise it only runs once.
  3. Check the sprite actually has that script , click the sprite thumbnail in the sprite list.
  4. Verify the sprite isn't hidden (use show block).
💡 Prevention Tip
Always start with the when green flag clicked block. If you want continuous movement, always wrap actions in forever.
🐛 Costume Not Changing
❌ Problem
You added "switch costume to..." but the sprite's appearance doesn't change visually.
✅ Solution
  1. Check the costume name matches exactly , spelling and spaces matter.
  2. Go to the Costumes tab and verify you actually created the costumes.
  3. Make sure you're targeting the right sprite , costumes are per-sprite.
  4. If using "next costume", the sprite cycles through existing costumes.
💡 Prevention Tip
Name your costumes clearly (e.g. "idle", "run1", "run2") so you can reference them in code without typos.
🐛 Variable Not Updating
❌ Problem
Your score variable stays at 0 even though you're collecting items. The variable reporter on stage shows the same number.
✅ Solution
  1. Make sure you created the variable first (Variables → Make a Variable).
  2. Use "change [score] by 1" , not "set score to 0" , when incrementing.
  3. Check the "for all sprites" vs "for this sprite" scope , is the right sprite reading it?
  4. Verify the "if touching [player]" condition actually triggers.
💡 Prevention Tip
Add the variable reporter to the stage so you can watch it update in real-time. Use "for all sprites" for shared scores.
🐛 Clone Issues
❌ Problem
Clones aren't appearing, or they're all doing the same thing, or they won't go away.
✅ Solution
  1. Clones need when I start as a clone to know what to do.
  2. Use delete this clone at the end of the clone script or it'll pile up.
  3. The original sprite (before cloning) can't use "delete this clone" , only clones can.
  4. Don't use forever without a wait inside clone scripts , it'll freeze Scratch.
💡 Prevention Tip
Limit clones with a "if number of clones < 50 then" check. Too many clones slow everything down.
🎮
Roblox 4 Errors
🐛 Script Not Running
❌ Problem
Your Lua script doesn't seem to execute at all. No output in the console, no errors, nothing happens.
✅ Solution
  1. Check the script type: Server scripts run on the server, Local scripts on the client.
  2. LocalScripts must be inside StarterPlayerScripts, StarterGui, or a Tool , not in ServerScriptService.
  3. Add print("Script started") at the top to confirm it runs.
  4. Make sure the script isn't disabled , check the Enabled property.
💡 Prevention Tip
Always start scripts with a print statement. If it never shows in Output, the script isn't running , check its parent location.
🐛 Part Not Anchored
❌ Problem
Your part falls through the baseplate or flies away when you hit Play. It's not staying where you placed it.
✅ Solution
  1. Select the part and check "Anchored" in the Properties panel.
  2. If it should move but stay in place, use a "BodyPosition" or "AlignPosition" constraint instead.
  3. Use WeldConstraints to stick parts together without anchoring each one.
  4. Parts in Workspace are affected by gravity unless Anchored = true.
💡 Prevention Tip
Get in the habit of anchoring static parts (walls, floors, props) as you build them. Only leave dynamic parts unanchored.
🐛 Remote Event Not Firing
❌ Problem
Client fires a RemoteEvent but the server never receives it, or vice versa. Nothing happens on the other end.
✅ Solution
  1. Check both scripts are listening on the same event name , typos are the #1 cause.
  2. Server scripts use RemoteEvent.OnServerEvent:Connect(...).
  3. Local scripts use RemoteEvent.OnClientEvent:Connect(...) and fire with :FireServer().
  4. Make sure the RemoteEvent is in ReplicatedStorage so both sides can access it.
💡 Prevention Tip
Create a ModuleScript that stores all RemoteEvent names as constants. Import it in both scripts to avoid typos.
🐛 Leaderstats Not Saving
❌ Problem
Leaderstats reset when the player rejoins. Coins, score, level , all gone on reconnect.
✅ Solution
  1. You need DataStoreService , leaderstats alone only creates the display, not persistence.
  2. Use game.Players.PlayerAdded to load saved data into leaderstats on join.
  3. Use game.Players.PlayerRemoving and BindToClose to save data on leave.
  4. Enable API Services in Game Settings → Security → Allow HTTP Requests.
💡 Prevention Tip
Always wrap DataStore calls in pcall() to prevent errors from crashing your server. Test with Studio play sessions first.
🔧
Godot 4 Errors
🐛 Node Not Found
❌ Problem
Godot says "Node not found" when you try to get a node. The scene loads but crashes on a get_node() call.
✅ Solution
  1. Check the node path is correct: use the Scene tree dock to verify names and nesting.
  2. Use $NodeName or %UniqueName , unique names need the "Unique" checkbox.
  3. Make sure the node exists in the current scene , it might be in a different scene.
  4. If instancing dynamically, wait for _ready() before accessing child nodes.
💡 Prevention Tip
Use unique node names (%) for frequently accessed nodes. Avoid deep paths like ../../UI/Panel/Label.
🐛 Signal Not Connected
❌ Problem
You emit a signal but the connected function never runs. Or Godot says "Can't emit non-existent signal".
✅ Solution
  1. Check the signal name is spelled correctly in both emit_signal() and connect().
  2. In the Node dock → Signals tab, verify the connection was actually made.
  3. Use signal_name.connect(callable) , make sure the Callable is valid.
  4. The emitting node must exist in the scene tree , signals don't work on freed nodes.
💡 Prevention Tip
Define signals with signal my_signal at the top of the script. Use the editor's Signals tab to connect , it auto-generates correct code.
🐛 Physics Not Working
❌ Problem
Objects fall through each other. Collision detection doesn't trigger. RigidBodies ignore the floor.
✅ Solution
  1. Both nodes need collision shapes , a Sprite alone has no collision.
  2. Check CollisionObject2D layers and masks , matching layers = can collide.
  3. StaticBody2D for floors/walls, RigidBody2D for physics objects, CharacterBody2D for players.
  4. For Area2D, use body_entered signal and make sure monitoring is on.
💡 Prevention Tip
Set up collision layers early. Layer 1 = world, Layer 2 = player, Layer 3 = enemies , then mask them logically.
🐛 Scene Not Loading
❌ Problem
Godot shows an error when loading a scene. "Invalid scene" or "Can't load resource".
✅ Solution
  1. Check the scene file (.tscn) exists at the correct path , files moved in Explorer break references.
  2. Use preload("res://path/to/scene.tscn") with exact paths from the FileSystem dock.
  3. Run "Reimport" on the FileSystem dock , some resources need reimporting after moves.
  4. Verify the scene's root node type is valid (e.g. not a missing custom class).
💡 Prevention Tip
Always move files from within Godot's FileSystem dock, never from Windows Explorer or Finder , that breaks internal references.
🎯
Unity 4 Errors
🐛 Null Reference Exception
❌ Problem
Unity throws "NullReferenceException: Object reference not set to an instance of an object" and your code stops.
✅ Solution
  1. Check the error line , which variable is null? Add a null check: if(obj != null).
  2. Make sure you assigned the reference in the Inspector (drag the object into the field).
  3. Check that GetComponent<T>() actually found the component , it returns null if not found.
  4. Don't access a GameObject after Destroy() , it's null after destruction.
💡 Prevention Tip
Use [SerializeField] private T field; and assign in Inspector. Or use FindObjectOfType<T>() in Awake(). Always null-check before using.
🐛 Component Not Assigned
❌ Problem
A script field shows "None (GameObject)" in the Inspector. The code can't find the component it needs.
✅ Solution
  1. Drag the GameObject from the Hierarchy into the Inspector field on your script.
  2. For components, drag the object that has the component (Unity finds it automatically).
  3. If the field is private, add [SerializeField] to expose it in the Inspector.
  4. Check the field type matches what you're dragging , e.g. a Transform, not a GameObject.
💡 Prevention Tip
Use [SerializeField] on private fields so you can drag-assign while keeping encapsulation. Never leave Inspector fields as None at runtime.
🐛 Physics Jitter
❌ Problem
Your object shakes or jitters when moving. The movement looks jerky and unstable.
✅ Solution
  1. Use FixedUpdate() for physics code, Update() for input-only code.
  2. Use Time.deltaTime when moving with transform.position , not with Rigidbody.
  3. For Rigidbody movement, use AddForce() or set velocity directly , not transform.position.
  4. Increase Rigidbody interpolation: set Interpolate to "Interpolate" in the Inspector.
💡 Prevention Tip
Rule of thumb: position changes via transform → Update(). Force-based movement via Rigidbody → FixedUpdate(). Never mix the two.
🐛 Scene Not Loading
❌ Problem
SceneManager.LoadScene("SceneName") does nothing or throws an error. The scene won't switch.
✅ Solution
  1. Add the scene to Build Settings: File → Build Settings → Add Open Scenes.
  2. Use the exact scene name as shown in the Hierarchy (no path, no .unity extension).
  3. Make sure using UnityEngine.SceneManagement; is at the top of the script.
  4. Check you're not loading a scene that doesn't exist in the build list.
💡 Prevention Tip
Use scene build indices: LoadScene(1) instead of names. Add all scenes to Build Settings as you create them.
🐍
Python / Pygame 4 Errors
🐛 Module Not Found
❌ Problem
Python says "ModuleNotFoundError: No module named 'pygame'" when you run your script.
✅ Solution
  1. Open a terminal and run: pip install pygame
  2. If you have multiple Python versions, try: pip3 install pygame
  3. Check you're using the same Python interpreter your editor is using.
  4. If using VS Code, select the correct interpreter (Ctrl+Shift+P → "Python: Select Interpreter").
💡 Prevention Tip
Create a virtual environment: python -m venv venv, then venv\Scripts\activate before installing packages.
🐛 Window Not Showing
❌ Problem
Your Pygame window doesn't appear, or appears blank/white. The script runs but nothing is drawn.
✅ Solution
  1. Make sure pygame.init() is called before creating the display surface.
  2. Check you have a game loop with pygame.display.flip() or pygame.display.update().
  3. Add pygame.event.pump() in your loop to prevent Windows "not responding".
  4. Verify your screen.fill() and draw calls happen before display.flip().
💡 Prevention Tip
Always use this structure: init → create display → game loop → flip → clock.tick. Every frame must call event.pump() and display.flip().
🐛 Collision Not Detecting
❌ Problem
Two sprites overlap on screen but your collision code says they don't collide.
✅ Solution
  1. Use sprite1.rect.colliderect(sprite2.rect) for rect-based collision.
  2. Make sure both sprites have self.rect = self.image.get_rect() set correctly.
  3. Update self.rect.center = (self.x, self.y) every frame if you move by x/y.
  4. For pixel-perfect collision, use pygame.sprite.collide_mask().
💡 Prevention Tip
Always update the rect after moving the sprite. Use pygame.sprite.groupcollide() for group-vs-group collisions.
🐛 Sound Not Playing
❌ Problem
You call pygame.mixer.Sound.play() but no sound is heard. The mixer loads but stays silent.
✅ Solution
  1. Check the sound file path is correct , use os.path.exists() to verify.
  2. Supported formats: WAV, OGG, MP3. Some MP3 files may not load , try OGG.
  3. Set mixer frequency: pygame.mixer.pre_init(44100, -16, 2) before pygame.init().
  4. For music vs sound effects: use pygame.mixer.music for background, Sound for SFX.
💡 Prevention Tip
Use OGG format for small sound effects. Call pygame.mixer.pre_init() before pygame.init() to avoid initialization issues.
🌐
JavaScript 4 Errors
🐛 Canvas Not Drawing
❌ Problem
Your <canvas> element is on the page but nothing appears on it. The drawing code runs but the canvas stays blank.
✅ Solution
  1. Check you called canvas.getContext('2d') and saved the result.
  2. Make sure the canvas has width/height attributes (not just CSS size).
  3. Drawing coordinates start at top-left (0,0). Check your x/y values.
  4. If using requestAnimationFrame, make sure the function actually calls itself.
💡 Prevention Tip
Set canvas width/height in JavaScript, not CSS: canvas.width = 800. CSS size scales the visual but not the buffer.
🐛 Event Not Firing
❌ Problem
You add an event listener for click or keydown but the callback never runs. The element exists but doesn't respond.
✅ Solution
  1. Make sure the element exists in the DOM when you add the listener , check for null.
  2. Event names are case-sensitive: "click" not "Click".
  3. Check if another element with a higher z-index is blocking clicks (pointer-events).
  4. For keydown, the target must have focus or you need to listen on document.
💡 Prevention Tip
Put your script at the end of <body> or use DOMContentLoaded. Log the element to console before adding listeners.
🐛 Image Not Loading
❌ Problem
An image shows as a broken link or doesn't appear. The onload callback may never fire.
✅ Solution
  1. Check the image path , use relative paths from the HTML file, not absolute.
  2. Wait for onload before drawing: img.onload = function() { ... }
  3. For local files, use a local server (VS Code Live Server, Python http.server).
  4. CORS: cross-origin images may load but can't be drawn to canvas without the server allowing it.
💡 Prevention Tip
Always use img.onload , never draw immediately after setting src. Use a local server for development.
🐛 Sound Not Playing
❌ Problem
Audio plays silently or not at all. The Audio element loads but .play() returns a rejected promise.
✅ Solution
  1. Browsers block autoplay until a user interacts. Play audio inside a click/keydown handler.
  2. Call audio.play() and catch the promise: audio.play().catch(e => ...)
  3. Check the audio file path and format (MP3/WAV/OGG supported by most browsers).
  4. Make sure the Audio object isn't muted and volume isn't 0.
💡 Prevention Tip
Use the Web Audio API or play sound on user's first click. "Click to start" screens solve the autoplay policy problem.