How can i tween color

i just don’t know whats wrong. this is my code

local TweenService = game.TweenService
local Explosion = script.Parent
local ExplosionSound = script.Explosion
local Players = game:GetService("Players")

Goal = {}
Goal.Size = Vector3.new(10,10,10
)
Goal.Transparency = 1
Goal.Color3 = Color3.new(1, 0, 0.0156863)

local Info = TweenInfo.new(
	1,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.InOut
)

local Tween = TweenService:Create(Explosion, Info, Goal)

Tween:Play()
ExplosionSound:Play()
Tween.Completed:Wait()
Explosion:Destroy()

Your Goal table is empty meaning it wont tween anything. you need to include everything you want to tween inside the table

it works anyway

Goal.Transparency = 1


local Explosion = script.Parent
local ExplosionSound = script.Explosion
local Players = game:GetService("Players")

Goal = {

Size = Vector3.new(10,10,10),

Transparency = 1,

Color = Color3.new(1, 0, 0.0156863)

}

local Info = TweenInfo.new(

1,

Enum.EasingStyle.Sine,

Enum.EasingDirection.InOut

)

local Tween = TweenService:Create(Explosion, Info, Goal)

Tween:Play()
ExplosionSound:Play()
Tween.Completed:Wait()
Explosion:Destroy()

here I fixed your script. I tested it and it’s working

it didn’t work, also forgot to state the error

 TweenService:Create no property named 'Color3' for object 'ContactExplosion'

Wait are you tweening a Part or a Explosion object?

Depends on object. Does your object have color property? It might be Goal.Color = Color3.new() instead.

tried that and it didn’t work, so yeah

What object are you trying to tween?

1 Like

im trying to tween a part color

Usually the property for Color is called Color not Color3. It takes a color3, but the property is called Color.

Create no property named 'Color3' for object 'ContactExplosion'

That error states you are trying to change a property called Color3, but that’s not a property of parts. You need to make that be Color

In other words

Goal.Color3 = Color3.new(1, 0, 0.0156863)

Should be

Goal.Color = Color3.new(1, 0, 0.0156863)
2 Likes

Cite your sources? Your and their way work the same, just yours adds the info directly in the table, which makes it look a bit more cluttered in my opinion.

local Goal = {}

Goal.Transparency = 1

It creates variables in the table. It’s the same for ModuleScripts, you can use the same method.

1 Like