#why doesn't this script work?

7 messages · Page 1 of 1 (latest)

dim ember
#

anyone know why? im trying to make a script where after 12 seconds has been elapsed, it takes a total of 1 second for the transition between colors for the decal.

local decal = game.Workspace.Monster1.Decal
local startColor = Color3.new(170/255, 170/255, 170/255)
local endColor = Color3.new(30/255, 30/255, 30/255)
local transitionTime = 1 -- Transition time in seconds
local totalTime = 12 -- Total time in seconds

local startTime = tick()
while tick() - startTime < totalTime do
local elapsedTime = tick() - startTime
local progress = math.clamp(elapsedTime / transitionTime, 0, 1)
local lerpedColor = startColor:Lerp(endColor, progress)
decal.Color3 = lerpedColor
wait()
end
decal.Color3 = endColor

#

its a local script located in the workspace which im not sure if thats the right path

wooden night
#

why don't you use a task.wait(12) instead of a while

dim ember
#

im fixing that problem right now lmao

fluid briarBOT
#

studio** You are now Level 5! **studio

dim ember
#

im a beginner so

wooden night
#

np lol, for your problem, you could just use tweenservice too