Script not changing color of part

Me and a friend are creating a tycoon to learn scripting better, sorry if this is a simple task, we just can’t figure it out! We want the parts coming out of the “dropper” to be red, but the script does not do that. It does everything else like making the position and size, but It just does not turn red for some reason. We have tried using BrickColor and that doesn’t work either.

 part = script.Parent.Parent
clickdetector = script.Parent
debounce = false

    local player = plr
    if debounce == false then
        debounce = true
        local block ="Part", workspace.Folder)
        block.Color = Color3.fromRGB(255, 0,  0)
        block.Position =, 502.959, -511.667)
        block.Size =, 1, 1)
        block.Anchored = false
        block.Name = "DispensedPart"
        debounce = false
        return player
1 Like = Color3.fromRGB(255, 0,  0)

maybe this? I remember once trying to change the color by a script, there has to be .new

1 Like

We tried that just now. Unfortunately it didn’t work.

block.Color = Color3.fromRGB(255, 0, 0).Color

Show me the output otherwise.


I cant seem to reproduce this behaviour with the code you provided so it must be something else in your game causing this. I also can’t see anything wrong with your code and when I test it the part is red. Are you sure this is the script causing the problem?

While I am here I will suggest a couple changes you could make to your script that are better practices:

  • Before defining any variables you should put local before it. I can’t remember the technical details behind doing this but generally it is better.

  • When using you shouldn’t use the parent argument because doing this increases the amount of internal calls. Instead you should change all the necessary properties then parent the object as the last thing. You may want to read this thread for more information: PSA: Don't use with parent argument. Here is a code sample as well:

local Part ="Part")
Part.Color = Color3.fromRGB(255, 0, 0)
Part.Size =, 1, 1)
Part.Parent = workspace -- Parents the part
  • You should remove the wait() at the beginning of your code because it is unnecessary. You should avoid using wait where you can because some developers have experienced incorrect or longer wait times when using wait().