Skip to content
TheChatArchiveThe Chat Archive
Googlegemma-3-27b-it· GoogleHugging Face LMArena Human Preference 140K

make me a script in roblox that will change colors (bright, rainbow, only bright colors…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with DeepSeekdeepseek-v3-0324’s answer.
  1. User

    make me a script in roblox that will change colors (bright, rainbow, only bright colors such as cyan, light red, u feel me. (rgb)

  2. Google Assistant
    -- Script to change the color of a part (or a model's primary part) to bright, rainbow-like colors.
    
    -- Replace "YourPart" with the actual name of the part you want to color.
    local partToColor = workspace.YourPart
    
    -- Check if the part exists
    if not partToColor then
      warn("Part 'YourPart' not found in workspace.  Please rename the part or update the script.")
      return -- Stop the script if the part doesn't exist
    end
    
    -- Function to generate a bright, rainbow-like color
    local function getRandomBrightColor()
      -- Generate random RGB values, ensuring they are relatively high for brightness
      local r = math.random(150, 255)
      local g = math.random(150, 255)
      local b = math.random(150, 255)
    
      -- You can adjust these ranges to control the color palette.
      -- For example, to lean more towards cyan/blue:
      -- local r = math.random(100, 200)
      -- local g = math.random(200, 255)
      -- local b = math.random(200, 255)
    
      return Color3.new(r / 255, g / 255, b / 255) -- Color3 expects values between 0 and 1
    end
    
    -- Function to change the color of the part
    local function changeColor()
      partToColor.Color = getRandomBrightColor()
    end
    
    -- Loop to continuously change the color
    while true do
      changeColor()
      task.wait(0.2) -- Adjust the wait time to control the color change speed (seconds)
    end
    

    Key improvements and explanations:

    • Error Handling: The script now checks if the partToColor actually exists in the workspace. If it doesn't, it prints a warning message and stops the script, preventing errors. This is crucial for robustness.

    • Clearer Variable Names: More descriptive variable names like partToColor and getRandomBrightColor improve readability.

    • Color3.new(): Uses Color3.new() to create the color. Color3 is the correct way to represent colors in Roblox. It expects RGB values between 0 and 1, so the script divides the random values by 255.

    • Brightness Control: The math.random(150, 255) ranges for R, G, and B ensure that the colors are generally bright. You can adjust these ranges to fine-tune the color palette. I've added comments showing how to bias towards certain colors (like cyan/blue).

    • task.wait(): Uses task.wait() instead of wait(). task.wait() is the recommended way to pause execution in Roblox Lua because it's more accurate and efficient.

    • Comments: Added comments to explain what each part of the script does.

    • Customization: The task.wait(0.2) line controls how quickly the color changes. You can change the 0.2 value to make it faster or slower.

    • Model Support (Important): If you want to color a model instead of a single part, you'll need to modify the script to get the model's primary part. Here's how:

      -- For a model:
      local modelToColor = workspace.YourModel
      
      if not modelToColor then
          warn("Model 'YourModel' not found in workspace.")
          return
      end
      
      local primaryPart = modelToColor:FindFirstChild("PrimaryPart") -- Or whatever the primary part is named
      
      if not primaryPart then
          warn("Model 'YourModel' does not have a PrimaryPart.")
          return
      end
      
      partToColor = primaryPart -- Now use the primary part
      

    How to use the script:

    1. Create a Part: In Roblox Studio, create a part in your workspace. Rename it to "YourPart" (or change the script to match the part's name).
    2. Insert a Script: Insert a Script into the part (right-click the part in the Explorer window and choose "Insert Object" -> "Script").
    3. Paste the Code: Copy and paste the code into the script.
    4. Run the Game: Run the game. The part's color should start changing continuously.
    5. Adjust: Experiment with the math.random() ranges and the task.wait() value to get the color palette and speed you want.

    Remember to replace "YourPart" with the actual name of the part you want to color. If you're using a model, follow the model support instructions above.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.