It might be simple, but theres an error thats not letting me assign a color to a part.
“Unable to assign property Color. Color3 expected, got nil” (line 26)
task.wait(.5)
local part0 = workspace.Parts.Part0
partNum = 0
local normalColors = {
Color3.fromRGB(86, 57, 22),
Color3.fromRGB(22, 31, 86),
Color3.fromRGB(25, 83, 86),
Color3.fromRGB(21, 86, 50),
Color3.fromRGB(86, 20, 21),
Color3.fromRGB(86, 33, 82),
Color3.fromRGB(86, 86, 86),
}
script.Parent.Triggered:Connect(function(plr)
if not plr then return end
partNum += 1
local newPart = part0:Clone()
newPart.Parent = workspace.Parts
newPart.Name = "Part" .. partNum
local chooseRandom = math.floor(math.random(0, 7))
newPart.Color = normalColors[chooseRandom]
print(normalColors[chooseRandom - 1])
newPart.Transparency = 1
game.TweenService:Create(newPart, TweenInfo.new(.5), {Transparency = 0}):Play()
if part0.ShouldRotate.Value == true then
newPart.Rotation += Vector3.new(0, 90, 0)
end
if part0.Side.Value == "Back" then
newPart.Position = part0.Position + Vector3.new(0, 0, -8)
newPart.Side.Value = "Front"
newPart.ShouldRotate.Value = true
part0 = newPart
elseif part0.Side.Value == "Front" then
newPart.Position = part0.Position + Vector3.new(-4, 3, 4)
newPart.Side.Value = "Left"
newPart.ShouldRotate.Value = false
part0 = newPart
elseif part0.Side.Value == "Left" then
newPart.Position = part0.Position + Vector3.new(8, 0, 0)
newPart.Side.Value = "Right"
newPart.ShouldRotate.Value = true
part0 = newPart
elseif part0.Side.Value == "Right" then
newPart.Position = part0.Position + Vector3.new(-4, 3, 4)
newPart.Side.Value = "Back"
newPart.ShouldRotate.Value = false
part0 = newPart
end
end)
I’ve tried debugging and trying to see the color that it’s giving an error, but it wont print anything out in the output.