you could do something like this which i did for a game of mine
local Text = "Text"
local Frame = script.Parent
local x = 0;
local y = 15;
local function ConvertFromOffsetToScalar(x, y)
return x/Frame.AbsoluteSize.X, y/Frame.AbsoluteSize.Y
end
local TextLabels = {};
local flicker = 0;
-- decided to add a flicker effect to show how it could be used you dont need this
local Run = game["Run Service"].RenderStepped:Connect(function(dt)
flicker += dt;
if flicker >= 0.06 then
flicker = 0;
else
return;
end
for i, Value in pairs(TextLabels) do
if math.random(1, 10) == 1 then
local rand = string.char(65+math.random(1, 25));
Value[1].Text = math.random(1, 2) == 1 and rand:lower() or rand
else
Value[1].Text = Text:sub(Value[2], Value[2]);
end
end
end)
-- flicker end
for i = 1, #Text do
local newTextLabel = Instance.new("TextLabel", Frame);
newTextLabel.Text = string.sub(Text, i, i)
local acX, acY = ConvertFromOffsetToScalar(x, y);
newTextLabel.Position = UDim2.new(acX,0,acY,0)
newTextLabel.BorderSizePixel = 0;
x += newTextLabel.TextBounds.X;
if x > Frame.AbsoluteSize.X then
y += newTextLabel.TextBounds.Y
x= 0
end
table.insert(TextLabels, {newTextLabel, i})
wait()
end
Woah this looks really confusing but legit.
ill try it tommorow. if it works ill do this as an solution
Also localscript or serverscript? where should it be parented
local script, you should set the Frame variable to be the frame which should be wrote on, you can also destroy the text labels if you ever need to, you dont need the wait in the loop either.
also how to tween each of them (but not at the same time) like after 1 sec it should tween the next like i showed in the video
So ill just make one Textlabel put the localscript inside the textlabel and thats it?
you could make a server script to create the text and use the clients to do the effects, if you want to tween each text label you should use a function such as sin or cos to get a wave and position your text labels like that every frame
I can get an example
Ok then you can write an example, sorry im not a master at scripting xd
i also have to go now to sleep while ur setting the example ill sleep and tmrw ill take a look at it and try it, if it works then ill mark this as solved. cya! see you tmrw
thats fine, my code is usually pretty confusing
this isnt my finest work but i added some features so it doesnt break when windows are resized and it fits way better, the way it handles it is quite bad but it should be good enough for the rare cases (the T’s are to test for new lines, dont mind them)
local Text = "TextTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT"
local Frame = script.Parent
local function ConvertFromOffsetToScalar(x, y)
return x/Frame.AbsoluteSize.X, y/Frame.AbsoluteSize.Y
end
local TextLabels = {};
local t = 0;
local Build = Vector2.new()
local TextUpdating = false;
local function BuildText(WhenTextLabelWritten)
local x = 0;
local y = 15;
for i = 1, #TextLabels do
if not TextLabels[i] then return "Already Running" end
TextLabels[i][1]:Destroy();
table.remove(TextLabels, i)
end
TextUpdating = true
for i = 1, #Text do
local newTextLabel = Instance.new("TextLabel", Frame);
newTextLabel.Text = string.sub(Text, i, i)
newTextLabel.Position = UDim2.new(0,x,0,y)
newTextLabel.BorderSizePixel = 0;
local acX, acY = ConvertFromOffsetToScalar(x, y)
x += newTextLabel.TextBounds.X;
if x > Frame.AbsoluteSize.X then
y += newTextLabel.TextBounds.Y
x= 0
end
Build = Frame.AbsoluteSize
table.insert(TextLabels, {newTextLabel, i, {x, y}, {acX, acY}})
if WhenTextLabelWritten then
WhenTextLabelWritten()
end
end
TextUpdating= false;
end
local Run = game["Run Service"].RenderStepped:Connect(function(dt)
t += dt;
for i = 1, #TextLabels do
local w = math.sin(t + i*0.31);
local Value = TextLabels[i];
Value[1].Position = UDim2.new(0, Value[3][1], 0, Value[3][2]+w*5)
end
if TextUpdating then return end;
--// Screen check due to scaling being not completely accurate (Keep this part);
if math.abs(Frame.AbsoluteSize.X - Build.X) > 0.1 then
--// Screen got smaller in x direction
--// We should probably remake the text
return BuildText();
elseif math.abs(Frame.AbsoluteSize.Y - Build.Y) > 0.1 then
--// Screen got smaller in y direction
--// Rebuild text;
return BuildText();
end
end)
BuildText(wait)
2 Likes
Can you make it like positioning the text?
like its
above corner.
can i change it?
maybe the middle
if you change the local x and y it should change where it starts to write (use parents absolute size to position it to corners since it uses offsets and its different for every screen which makes it a little complicated)