Unable to Tween TextLabel Position

Hey. I’ve been staring at the screen for a while now trying to find what I’m doing wrong here in the code. I also created a new script where I programmed what is my problem, which is the tweening of the TextLabel position. I also looked at the documentation and I have no idea what is wrong with my code.

Basically, I have this count system, but for some reason it isn’t tweening. Nothing is written in the output except the prints I put there to see what’s wrong. I also tried changing where the script is located. Everything is printing normaly, but it’s just not working.

Code (StarterPlayerScripts):

local TS = game:GetService("TweenService")

local tInfo = TweenInfo.new(1, Enum.EasingStyle.Back, Enum.EasingDirection.Out, 0, false, 0)

local frame = game.StarterGui.partsCounter.Counter
local text = frame.Number

local function counter ()
	text.Position = UDim2.new(0.5, 0, 0.2, 0)
	TS:Create(text, tInfo, {Position = UDim2.new(0.5, 0, 0.4, 0)}):Play()

	print("Animated!")
end

while true do
	
	counter()
	
	task.wait(2)
end

The location of the TextLabel I’m trying to tween:
image

You are calling the frame from StarterGui, you should be using the PlayerGui. Probably something like this:

local frame = game.Players.LocalPlayer:WaitForChild("PlayerGui").partsCounter.Counter
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.