local t = 3
local ChangeDelay = 0.5
local TweenService = game:GetService("TweenService")
local Part = script.Parent
local Colors = {
Color3.fromRGB(255, 0, 255);
Color3.fromRGB(0, 38, 255);
}
while wait(ChangeDelay) do
local Change = {Color = Colors}
local Tween = TweenService:Create(Part, TweenInfo.new(4, Enum.EasingStyle.Quart, Enum.EasingDirection.In), Change)
Tween:Play()
end
Hello!
This error is ocurring because you are trying to change the properties to an array…
If you want you can make 2 tweens: One for the first color and one for the second color.
You’re using the table itself as a tween value instead of one of the Color3 values you set.
You gave it it an array of colors to tween from, you have to give it the first color given or the second, Are you trying to make it go through all the colors and tween 1 by 1? You can do this for that
local t = 3
local ChangeDelay = 0.5
local TweenService = game:GetService("TweenService")
local Part = script.Parent
local Colors = {
Color3.fromRGB(255, 0, 255);
Color3.fromRGB(0, 38, 255);
}
local index = 1
while wait(ChangeDelay) do
local Change = {Color = Colors[index]}
local Tween = TweenService:Create(Part, TweenInfo.new(4, Enum.EasingStyle.Quart, Enum.EasingDirection.In), Change)
Tween:Play()
index = index == #Colors and 1 or index + 1
end
If not, you can just reference one or the other
local Change = {Color = Colors[1]} --First color
local Change = {Color = Colors[2]} --Second color
What do you mean, I dont understand
This that you have gives it a table of the colors you set, you’re not giving a single one, you’re giving multiple
The error says it all, you’re supposed to supply a Color3 value, but you’re giving it a table.
so doing [index] will do all of the colors?
You are trying to change the Color to a Table, not a Color3 value.
Again, if you’re trying to do it 1 by 1, you can do what I had mentioned, although you’d have to change it a bit to this if you want it to wait for the tween to finish
local t = 3
local ChangeDelay = 0.5
local TweenService = game:GetService("TweenService")
local Part = script.Parent
local Colors = {
Color3.fromRGB(255, 0, 255);
Color3.fromRGB(0, 38, 255);
}
local index = 1
while wait(ChangeDelay) do
local Change = {Color = Colors[index]}
local Tween = TweenService:Create(Part, TweenInfo.new(4, Enum.EasingStyle.Quart, Enum.EasingDirection.In), Change)
Tween:Play()
Tween.Completed:Wait()
index = index == #Colors and 1 or index + 1
end
do I need to make index a variable since there is a orange line under it?
Wait what is your code currently? I think you forgot to make an index variable like how I had done in the example given
Try out what I had done
local t = 3
local ChangeDelay = 0.5
local TweenService = game:GetService("TweenService")
local Part = script.Parent
local Colors = {
Color3.fromRGB(0, 38, 255);
Color3.fromRGB(255, 0, 255);
}
while wait(ChangeDelay) do
local Change = {Color = Colors[]}
local Tween = TweenService:Create(Part, TweenInfo.new(4, Enum.EasingStyle.Quart, Enum.EasingDirection.In), Change)
Tween:Play()
end
Okay before I continue, what are you trying to do exactly with the Colors table? What’s the code meant to do?
just loop it, but if I do index 1 then it will just tween to the same color
Then make it change the index if you’re trying to make a loop.
My code does as you want then just as I expected, try it out. How it works is simple, the index variable grabs the Color located in the table using the specific number in the variable, then it plays the tween, and then waits for it to finish before either incrementing index or setting it back to 1
If you need more info about the code, I can explain all that is needed
When I play it doesn’t tween, i did the index
Okay, show me your code again to see if something’s wrong there
Ok now it works, but it only tweens to blue not the other