How I change a color slowy

Hello develupers I want to change a color slowy using a loop fuction ,I know to how to make a loop fuctions but what do I put in the center?


Repeat
Game.lighting.Anbient.color3.new = Game.lighting.Anbient.color3.new + ?
Wait(0.1)
Until Game.lighting.Anbient.color3.new == (250, 0, 0)

1 Like

You should probably check developer.roblox.com and Search tween or tween.

1 Like

Are you attempting to constantly change the color over time to random values? Or are you trying to change the color once and only once, smoothly?

1 Like
repeat
  game.Lighting.Ambient = Color3.fromRGB(game.Lighting.Ambient.R + 1, 0, 0)
  wait(0.1)
until game.Lighting.Ambient == Color3.fromRGB(250, 0, 0)

Or better yet

local tweenService = game:GetService("TweenService")
local tInfo = TweenInfo.new(4) --Take 4 seconds to change the color
local tween = tweenService:Create(game.Lighting, tInfo, {
  Ambient = Color3.new(1, 0, 0);
})

tween:Play()
tween.Completed:Wait()
2 Likes