Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can't apply a color value to a folder of meshparts?

Asked by 3 years ago

What I'm currently trying to do is make a color changing script using tweening and I'm trying to use it on a string of LED models that I had compiled. The script itself works perfectly fine if, for instance, I paste the script into the object and call for that object it works as attended, but currently I'm trying to get the children of a folder that holds all the LED meshparts and when I attempt to apply the color to the children it gives me the error "Unable to cast value to Object".

local ledFolder = game.Workspace:WaitForChild("ledFolder")
local ledLights = ledFolder:GetChildren()

local TweenService = game:GetService("TweenService")
local TweeningInformation = TweenInfo.new(
    2,
    Enum.EasingStyle.Quad,
    Enum.EasingDirection.InOut,
    -1,
    true,
    0
)

local PartProperties = {
    Color = Color3.fromRGB(135, 13, 165)
}

local Tween = TweenService:Create(ledLights,TweeningInformation,PartProperties)
Tween:Play()

This is the entirety of the script, the script itself is placed in ServerScriptService. I've attempted making a separate table of all the LEDs as well as tried calling for BrickColor. Any help or pointers to why it won't apply the color value to the meshparts in the folder would be greatly appreciated.

0
I don't think you can tween mutiple parts at once since the tween:Create function allows (instance, tweeninfo, propertytable) as you see the 1st argument is 'instance' not table since :getchildren() returns a table. so i think you gotta tween the meshparts individually. i could be wrong though MarkedTomato 810 — 3y

Answer this question