So, currently I’m making a Got Talent franchise game and I have to make a screen for it, which would have show’s logo and background which my make it attractive.
I’m facing issue with setting-up the script to make the two decals I have change their transparency gradually, for example, 0 to 0.2 so there is fade effect during the change of the decals.
Try this, I have no idea if it works.
Modify the first 6 lines of course to your game.
local Sign = workspace["Small Screen L"]
local Decal1 = Sign.M1
local Decal2 = Sign.M2
local MinTransparency = 0
local MaxTransparency = 0.5
local FlashSpeed = 1
local Timer = 0
local Delta = (MaxTransparency - MinTransparency) / 2
local V = MinTransparency / 2 + MaxTransparency / 2
game:GetService("RunService").Heartbeat:Connect(function(Step)
Timer += Step * FlashSpeed
local Sine = math.sin(Timer * math.pi)
Decal1.Transparency = Sine * Delta + V
Decal2.Transparency = -Sine * Delta + V
end)
local tweenService = game:GetService("TweenService")
local decal = workspace.Part.Decal
local tweenInfo = TweenInfo.new(1)
local goal = {Transparency = 1}
local tween = tweenService:Create(decal, tweenInfo, goal)
tween:Play()
local decal1 = script.Parent:FindFirstChild("M1")
local decal2 = script.Parent:FindFirstChild("M2")
local transitionDuration = 0.5 -- the duration of the transition (in seconds)
local interval = 0.009 -- the interval between transparency changes
local function transition(decal1, decal2)
local transparency = 0
local direction = interval / transitionDuration -- the transparency change per second
while transparency < 1 do
decal1.Transparency = transparency
decal2.Transparency = 1 - transparency
wait(interval)
transparency = transparency + direction
end
decal1.Transparency = 1 -- Ensure final transparency value is set accurately
decal2.Transparency = 0
end
while true do
-- Transition from Decal1 to Decal2
transition(decal1, decal2)
wait(transitionDuration)
-- Transition from Decal2 to Decal1
transition(decal2, decal1)
wait(transitionDuration)
end
This code can also work. Just make sure the part color is set to something darker if your decal is the same and vice versa.