It’s better to use the Animator object instead, and call LoadAnimation() from there
OP though, if it’s just a BasePart we’re talking about here I believe you can just do something like BrickColor.random so that way we don’t have to workaround using something like:
local RanColor = Color3.FromRGB(math.random(1, 255), math.random(1, 255), math.random(1, 255))
Cause that’s not fun to deal with
I can give you an example of a possible idea that could work:
local Dummy = workspace:WaitForChild("Dummy")
local Hum = Dummy:WaitForChild("Humanoid")
local Animator = Hum:WaitForChild("Animator")
local AnimationObject = nil -- You're gonna have to change this with your Animation Object, cause "nil" in this example is just a placeholder
local Block = workspace:WaitForChild("Block") -- Replace that with what part you want to change color with
local function ChangeColor()
Block.BrickColor = BrickColor.random()
local Anim = Animator:LoadAnimation(AnimationObject)
Anim:Play()
end
ChangeColor() -- We want to call this so that the function plays its actions