-
Tweening the textransparency of an object and making it appear for a few seconds (Fade-in/Fade-out) effect being made using tweens.
-
Okay so I may have an idea of the issue, but it doesn’t make any sense to me. The script is unsuccessful in changing the text label’s text transparency property but it tweening is going through which means it is working.
It’s either the referencing (which isn’t likely) or the actual tweening not functioning as intended. No in-game errors and all print statements go through. I almost forgot to mention, but the part on touch is working perfectly fine (the sound is being played and prints go through)
The screengui is set to enabled by default and the textfont is set to visible / texttransparency set to 1 by default. No other ui is in the way of it appearing.
- I’ve tested changing the transparency using a separate script and that worked successfully, so it isn’t an issue with the actual textlabel or screengui.
local Players = game:GetService("Players")
local soundService = game:GetService("SoundService")
local tweenService = game:GetService("TweenService")
local startergui = game:GetService("StarterGui")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
script.Parent.Enabled = true
local function createTitle(partName, soundName, titleName, partSize, partPosition)
local part = Instance.new("Part")
part.Name = partName
part.Size = partSize
part.CFrame = CFrame.new(partPosition)
part.CanCollide = false
part.Anchored = true
part.Transparency = 1
part.CastShadow = false
part.Parent = workspace.Barriers
mouse.TargetFilter = part
local titleSound = soundService.AreaTitleSounds[soundName]
local title = startergui.AreaTitleScreen[titleName]
local lastTriggered = 0 -- Moved inside the createTitle function
local function playTitleAndSound()
local currentTime = os.time()
if currentTime - lastTriggered < 60 then
return
end
lastTriggered = currentTime
titleSound:Play()
local tweenInfo = TweenInfo.new(4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local properties = {TextTransparency = 0}
local showTitleTween = tweenService:Create(title, tweenInfo, properties)
showTitleTween:Play()
wait(3)
local fadeProperties = {TextTransparency = 1}
local fadeTween = tweenService:Create(title, tweenInfo, fadeProperties)
fadeTween:Play()
end
part.Touched:Connect(playTitleAndSound)
end
-- In-game Titles (Remember: Make each text transparency set to "1" so it automatically appears through the fade-in)
createTitle("FrostwoodTrigger1", "AreaTitleSound1", "Frostwood", Vector3.new(20, 27, 1), Vector3.new(0, 14.5, 49.75))
Sorry for rushing through this question, I’m a little desperate for someone to point any errors out or methods in trying to find the issue. Any/All feedback is appreciated.