Hello developers, how can I make this, but it fades into random colours and make it smooth.https://gyazo.com/fdda6f197aa0257a6808aea53bca1694
You could use tweening to tween the colors smoothly and using Color3.random
Ok, however I’m not good at scripting, how could I do this?
Try to take a look into this article, TweenService provides the ability to smoothly move into a different property (Whether it be the Color, Transparency, Size, etc)
Now say we have just a random light somewhere within the workspace
local RandoLight = workspace:WaitForChild("PointLight")
local TweenService = game:GetService("TweenService")
What we can do, is use TweenService
's “Create()” function to be able to properly tween an Object
There are a couple of parameters though to go over, but I’ll just keep it simple
- The Instance/Object you want to Tween (Or
RandoLight
) - A
TweenInfo
constructor which is basically configuring the Settings of your Tween (More info on that here) - The Properties of that Instance/Object you wanna Tween
local RandoLight = workspace:WaitForChild("PointLight")
local TweenService = game:GetService("TweenService")
local TweenSettings = TweenInfo.new(
2, --This is the duration of how long you want the Tween to last
Enum.EasingStyle.Quad, --The type of style you want the Tween to look like
Enum.EasingDirection.Out, --The direction where you want the Tween to start from
0, --Say you wanted to repeat this Tween, if not just set it to 0
false, --Say you wanted to reverse this Tween, if not just set it to false
7 --Adding a delay would basically make it wait (x) seconds before actually playing the Tween, if you don't want one set it to 0
)
local TweenProperties = { --This is basically the same as your Properties inside your Studio
Color = Color3.fromRGB(200, 0, 0)
}
local Tween = TweenService:Create(RandoLight, TweenSettings, TweenProperties)
Tween:Play()
After finishing your Tween, you can call Play()
on it and watch it slowly move to the red color!
Theres a Syntax Error on line 10/11
Edit: Wouldnt it be {} instead of () ?
local TweenService = game:GetService("TweenService") -- Getting the tweening service!
wait(5) -- waiting so you can catch on and see it!
local part = Instance.new("Part") -- Creating the part
part.Position = Vector3.new(0, 10, 0) -- Position of the part
part.Anchored = true -- Properties of the part
part.BrickColor = BrickColor.new(Color3.new(0.784314, 0.784314, 0.784314)) -- Original color
part.Parent = game.Workspace -- Parenting it
local goal = {Color = Color3.new(0, 0, 0)} -- Change the 0,0,0 to whatever you want to tween its color to -- let's say yellow to blue etc
local tweenInfo = TweenInfo.new(10, Enum.EasingStyle.Quad) -- Info
local tween = TweenService:Create(part, tweenInfo, goal) -- Creating the tween
tween:Play() -- Playing the tween
Whoops, I edited it (Forgot a comma), try again
Hi, so I changed it a bit as the beam i’m trying to change the colour of,
Heres the script, however it doesnt seem to want to change the colour may I be able to ask why this might be?
Try my script?
local TweenService = game:GetService("TweenService") -- Getting the tweening service!
wait(5) -- waiting so you can catch on and see it!
local part = Instance.new("Part") -- Creating the part
part.Position = Vector3.new(0, 10, 0) -- Position of the part
part.Anchored = true -- Properties of the part
part.BrickColor = BrickColor.new(Color3.new(0.784314, 0.784314, 0.784314)) -- Original color
part.Parent = game.Workspace -- Parenting it
local goal = {Color = Color3.new(0, 0, 0)} -- Change the 0,0,0 to whatever you want to tween its color to -- let's say yellow to blue etc
local tweenInfo = TweenInfo.new(10, Enum.EasingStyle.Quad) -- Info
local tween = TweenService:Create(part, tweenInfo, goal) -- Creating the tween
tween:Play() -- Playing the tween
Ah, you’re attempting to Tween a Beam’s Color which isn’t exactly a Color3
value, it’s a ColorSequence
Unfortunately I don’t believe you’re able to tween ColorSequences
just using TweenService
, you’ll have to stick with either Light Objects or you could take a further look into this post here:
This isn’t even a fade (tween), this looks more like a Light instance with its color property being changed to different colors.
https://developer.roblox.com/en-us/api-reference/property/Beam/Color
The “Color” property of a Beam instance is assigned a ColorSequence value not a Color3 value.
To create a fade effect, you’ll need to use a loop instead of a tween. You are unable to tween colorsquences like @JackscarIitt mentioned.
So I’m guessing this it 100% impossible to do?
Well you could try using a loop instead of a tween as samtheblender said