How do I tween a text size?

I’m trying to tween the text size when the ray detects a player. But It’s not working… How exactly do I tween the Text size?

local TextLabel = game:GetService("StarterGui").ScreenGui1.Frame.TextLabel
local info = TweenInfo.new(
	3,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.InOut,
	0,
	true,
	0


)

goal = {
	
	Size = UDim2.new({0, 2},{0, 2})
	
}

local TweenCreate = TweenService:Create(TextLabel, info, goal) -- FInish Later
print("ok")

while wait() do -- Infinite loop

	
	local Ray = workspace:Raycast(Origin.Position, Direction, rayCastParams) -- Calling the rayCast with all the neccessary requirements. Similiar to RayCast
	if Ray then -- If ray is true then..
		print(Ray)
		if Ray.Instance.Parent == character then -- If ray is hitting the character then
			
			
			local rayDistance = (Origin.Position - Ray.Position).Magnitude -- Dont yet fully understand.
			warn("Distance:", rayDistance)
			Status.Value = "Detected "..player.Name
			TweenCreate:Play()```

Are you sure you wanna change the text size? If so instead of udim you just have to put numbers between 1-100 (also as the guy below said if you wanna change text size you must type TextSize instead of Size)

I’m seeing 2 possible mistakes here:

  • Goal is Size, and Size belongs to the TextBox, you would have to change it to “TextSize” instead.
  • The GUI you have set up may have the “Text Scaled” property, which could be stopping the text size to be sized.
1 Like

You are tweening the size of the text in StarterGui. Tweening or affecting an object in StarterGui will not do anything. Instead of StarterGui, tween the text from the Player’s gui.

1 Like

lol, actually i didn’t even notice that

Wait so do I just drag the screenGui into player scripts and redefine it?

Not exactly, what I suggest doing is moving your script into starterplayerscripts and using game.Players.LocalPlayer.PlayerGui instead of StarterGui