How To Make A Text Move Off Screen

I’m trying to make a text move onto the screen after you touch a certain part but i cant get the text to move onto the screen?

-Here’s The Script

finish = false
local Players = game:GetService(“Players”)
local player = Players.LocalPlayer
local playerGui = player:WaitForChild(“PlayerGui”)
local text = playerGui:WaitForChild(“WinnerText”)
local tweenService = game:GetService(“TweenService”)

local finishLine = workspace:WaitForChild(“FinishLine”)
local counter = playerGui:WaitForChild(“Counter”)

local function onTouched(hit)
if hit.Parent and not hit.Parent:FindFirstChild(“Humanoid”) then
return
end

local playerHit = Players:GetPlayerFromCharacter(hit.Parent)
if playerHit ~= player then
	return
end

counter.Frame.Visible = false
counter.Frame2.Visible = false
counter.TextLabel.Visible = false
-- im focusing on this script right here⬇️
local goal = {}
goal.Position =  Vector2.new({0.175, 0},{0.251, 0})
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine)
local tween = tweenService:Create(text, tweenInfo, goal)

end

– Events
finishLine.Touched:Connect(onTouched)

assuming this is on normal server or client sided script (being put in part), looking at goal position, it only accepts UDim2 instead of Vector2

for tweenservice when you’re creating, you need to specify property, The way you’re doing isn’t how it works so from this

local tween = tweenService:Create(text, tweenInfo, goal)

should’ve just turned into

local tween = tweenService:Create(text, tweenInfo, {Position = goal})

i think you are missing something. Try this instead:

local tween = tweenService:Create(text, tweenInfo, goal)
tween:Play()
1 Like

I added your guys recommendations but i still get this error:
TweenService:Create no property named ‘Position’ for object ‘WinnerText’ - Client - LocalScript:28

Replace goal.Position = Vector2.new({0.175, 0},{0.251, 0}) with this:

goal.Position =  UDim2.new(0.175, 0, 0.251, 0)

I still got the same error, do you got any other ideas?

Send the script, then i’m gonna check in studio whats wrong

It’s a local script under StarterPlayerScripts

finish = false
local Players = game:GetService(“Players”)
local player = Players.LocalPlayer
local playerGui = player:WaitForChild(“PlayerGui”)
local text = playerGui:WaitForChild(“WinnerText”)
local tweenService = game:GetService(“TweenService”)

local finishLine = workspace:WaitForChild(“FinishLine”)
local counter = playerGui:WaitForChild(“Counter”)

local function onTouched(hit)
if hit.Parent and not hit.Parent:FindFirstChild(“Humanoid”) then
return
end

local playerHit = Players:GetPlayerFromCharacter(hit.Parent)
if playerHit ~= player then
	return
end

counter.Frame.Visible = false
counter.Frame2.Visible = false
counter.TextLabel.Visible = false

local goal = {}
goal.Position =  UDim2.new({0.175, 0},0,{0.251, 0})
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine)
local tween = tweenService:Create(text, tweenInfo, goal)

tween:Play()
end

– Events
finishLine.Touched:Connect(onTouched)

might be the service itself since it was after a text variable were created, move them to the top of player service (there’s another thing wrong here for the text)

also mind screenshottin me the startergui???

I moved it up and there isn’t an error anymore, but it doesn’t move at all.
(I’ll get a screenshot)

Youre position sentence is incorrect, make sure there are no { in it. Copy the sentence below:
UDim2.new(0.175, 0, 0.251, 0)

make sure its this:
goal.Position = UDim2.new(0.175, 0, 0.251, 0)

I still got an error, should i change the location of where the local script is?

You can try to put it in the ServerScriptService, but idk if that works.

would be better to put it in StarterGui also ServerScriptService is for Server side only, localscript wont even work there

another wrong things ive mentioned and noticed is the way you put text in, since textlabels are 2D UI, you have to put those in the ScreenGUI to display and see the animations of text, putting them outside screengui doesn’t seem to work either.

Maybe its because it is in a local script, I think something with touching parts only works in scripts.

how do you i think i could transfer it to a normal script instead of a local script because it uses “LocalPlayer” in it?

What is winner text? A text label? A screengui?
Screen Guis don’t have a Position property, but act as a container for other GUI elements. If it’s anything else it may not render properly unless it is parented to a screen gui.

1 Like

Thats probably it, ill try to fix it rq.

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