Tween Module for TextTransparency Not Working

Hey! I’m making a loading screen, but I have an issue where a function I wrote in a ModuleScript located in ReplicatedStorage just isn’t working. I made a print() command to try and see if it was the function, but it was still called. I think the most liable culprit would either be the arguments I give when firing the function, or some kind of overarching behavior in the ScreenGui I’m using. Here’s the ModuleScript's code:

local UIModule = {}

local TweenService = game:GetService("TweenService")
local ReplicatedFirst = game:GetService("ReplicatedFirst")

--FUNCTIONS FOR THE MAIN MENU/BASICS

function UIModule.TweenTextTransparency(subject, numberGoal:number, timeTween:number)

	local Anim = TweenService:Create(subject, TweenInfo.new(timeTween), {TextTransparency = numberGoal})
	Anim:Play()
	print("playing" .. subject.Name .. " TextTransparency Tween")

end


return UIModule

And here’s my LocalScript’s code, which is located in a Frame that parents the textlabel I’m referencing in the script:

local UIModule = require(game:GetService("ReplicatedStorage").Modules.UIModule)

local MainFrame = game:GetService("StarterGui"):WaitForChild("MainMenu"):WaitForChild("MainFrame")

local TweenService = game:GetService("TweenService")

local PlayButton = MainFrame:WaitForChild("Play")
local CreditText = MainFrame:WaitForChild("GameBY")
local MainTitle = MainFrame:WaitForChild("Title")

--START-UP
	
task.wait(2)
UIModule.TweenTextTransparency(CreditText, 0, 1)

Thank you for your time.

Could you clarify the issue? Which function in the module isn’t working properly?
I tried your scripts, and they worked perfectly for me. It’s probably not the module itself.
I’d very glad if you could give me more information.

You’re referencing StarterGui instead of PlayerGui, where the frame that the player sees is in. Let me explain:

When a player joins a game, the contents in StarterGui are cloned and put into their PlayerGui so that they are seeing a version of the UI unique to them (imagine if every player was seeing one single frame). To fix this, the MainFrame variable should be like this:

local MainFrame = script.Parent.MainFrame
1 Like