Problem with TextTransparency

So I did this local script, but then there is a problem

local player = game.Players.LocalPlayer
local ScreenGui = player.PlayerGui.ScreenGui
local object = ScreenGui.Frame


local TweenService = game:GetService("TweenService")


object.Position = UDim2.new(0.87, 0, 1.1, 0)



local goal = {}
goal.Position = UDim2.new(0.87, 0, 0.95, 0)


local tweenInfo = TweenInfo.new(
	1, -- Time
	Enum.EasingStyle.Sine, -- EasingStyle
	Enum.EasingDirection.Out, -- EasingDirection
	0, -- RepeatCount (when less than zero the tween will loop indefinitely)
	false, -- Reverses (tween will reverse once reaching it's goal)
	0 -- DelayTime
)

local tween = TweenService:Create(object, tweenInfo, goal)

object.Transparency = 0
object.TextLabel.TextTransparency = 0


local goal2 = {}
goal2.Transparency = 1
goal2.TextLabel.TextTransparency = 1

local tweenInfo = TweenInfo.new(
	1, -- Time
	Enum.EasingStyle.Sine, -- EasingStyle
	Enum.EasingDirection.Out, -- EasingDirection
	0, -- RepeatCount (when less than zero the tween will loop indefinitely)
	false, -- Reverses (tween will reverse once reaching it's goal)
	0 -- DelayTime
)

local tween2 = TweenService:Create(object, tweenInfo, goal2)
game.ReplicatedStorage.ShowText.OnClientEvent:Connect(function()
	tween:Play()
	wait(5)
	tween2:Play()
end)

The problem is in this part:

local goal2 = {}
goal2.Transparency = 1
goal2.TextLabel.TextTransparency = 1

I dont know whats wrong with it, I hope someone know how to fix this. Thanks!

2 Likes
local goal2 = {}
goal2.Transparency = 1
goal2.TextTransparency = 1 --you originally had "goal2.TextLabel.TextTransparency" 
1 Like

for the middle of the error part, did you mean BackgroundTransparency instead of just Transparency?

image
Its located like this soo…

Ohh yea, backgroundtransparency, letme try that

Still no,


Line 34 is this:

goal2.TextLabel.TextTransparency = 1

goal2 is a table, maybe you can do this

local goal2 = 1
--other line
local tween2 = TweenService:Create(object, tweenInfo, {BackgroundTransparency = goal2})
local tween2A = TweenService:Create(object, tweenInfo, {TextTransparency = goal2})
--put this in function loop
tween2A:Play()

(wait it’s because you’re merging 2 different properties with the same values)

1 Like

Ah ok let me try that. Thank you

Its working! Thank you so much!

1 Like

The goals parameter of the TweenService method named “:Create()” does not accept references to instances, those references should be passed as the first argument to the method.

The goals table’s keys/indices should match the names of properties of the object you intend to tween, the values assigned to those keys/indices are the goals of the aforementioned properties.

Oh okay. Thank you so much for the information!