Hi!
So I’ve been working on a hangout/dancing game, and I have glowsticks that you hold when you dance. I made a rainbow one too.
As you might know TweenService cannot tween trails normally, so I made a hacky solution that should work, however it isn’t. Here is the issue:
As you can see, the stick itself tweens but the color does not change. Here is the script:
local Part = script.Parent
local Trail = Part:WaitForChild("Trail")
local Val = Instance.new("Color3Value")
Val.Value = Color3.new(0,0,0)
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local function SimpleTween(Object, Length, Style, Direction, Properties)
local Tween = TweenService:Create(
Object,
TweenInfo.new(Length, Enum.EasingStyle[Style].Value, Enum.EasingDirection[Direction].Value),
Properties
)
Tween:Play()
Tween.Completed:Wait()
Tween:Destroy()
end
while true do
SimpleTween(Part, 1, "Linear", "Out", { Color = Color3.new(1,0,0) })
SimpleTween(Part, 1, "Linear", "Out", { Color = Color3.new(1,1,0) })
SimpleTween(Part, 1, "Linear", "Out", { Color = Color3.new(0,1,0) })
SimpleTween(Part, 1, "Linear", "Out", { Color = Color3.new(0,1,1) })
SimpleTween(Part, 1, "Linear", "Out", { Color = Color3.new(0,0,1) })
SimpleTween(Part, 1, "Linear", "Out", { Color = Color3.new(1,0,1) })
end
RunService.Heartbeat:Connect(function()
Val.Value = Part.Color
Trail.Color = ColorSequence.new(Val.Value)
end)
Some help would be appreciated!
Thank you!
It’s probably something simple I overlooked.