Hey! So basically I was watching some video on YT and I got into this game called: “A Stereotypical Obby” and I wondered how could I make the text shaky and glitched like on this game.
Here’s a video that shows you exactly where it happens:
I’ve seen plenty and plenty of tutorials but none could make the text shake like on this game, if anyone have any idea of how I could script this, I’d appreciate it.
In order to do this, you would have to create multiple separate TextLabels with the letters that spell out the word that you are trying to say, then parent them inside of a folder which would be located inside of your StarterGui.
Then, your probably gonna have to do some tweening with the TextLabels to make them move in like a glitchy type of angle.
This would probably be a little hacky, but I recommend maybe creating a ModuleScript for trying to create your letters, add a starting position to where the first letter is going to appear, play the glitch animation on the TextLabel, then you would have some type of glitchy word system from there.
Nevermind, it wouldn’t be good to use a UIGridLayout, since you would only be tweeting one position, my bad.
I will probably try and create a system of mine in a few minutes and see how it goes from there.
As shown in the video, the text shakes it all together, would it really be needed to create separated textlabels? The tutorials I’ve seen are trying to reach the same thing as yours, but It’s based on UNDERTALE quotes, it doesn’t really fits the video I have mentioned.
And if possible, could you show me any example of script? I have no idea how could I script this.
This is single label shaking not multiple letters
Just tween the label or offset it repeatedly in a for loop
for ye = 1,4,1 do
label.position = label.position - UDim2.new(math.random(1,10)/10,0,0,0) -- assume scale
label.rotation = label.rotation -- same thing alternate between subtracting and adding amount
task.wait(0.4)
end
As other people have said, you can create a text label for each and every letter, and create a loop where the size and the positions of the labels change randomly.
(With animations if you want to)
Or, you can do the same thing with a text label with the full string if that’s easier for you.
If its every letter, then it wont shake it all together like in the video I showed, It will shake every letter in random positions, the video shows that they’re synced.
EDIT: And do you have any idea how could I script that? I have no idea at all.
Then as I said, you can just do the same thing with a full text label instead.
Here’s an example:
local TextLabel = script.Parent -- The text label
local TextLabelPos = TextLabel.Position -- The position of the text label that we're gonna use to calculate the random position
for i = 1, 100, 1 do
local randomPosX = TextLabelPos.X.Scale + (math.random((TextLabelPos.X.Scale * 10) - 10, (TextLabelPos.X.Scale * 10) + 10) / 1000) -- Calculating the X scale
local randomPosY = TextLabelPos.Y.Scale + (math.random((TextLabelPos.Y.Scale * 10) - 10, (TextLabelPos.Y.Scale * 10) + 10) / 1000) -- Calculating the Y scale
-- The X and Y scales are multiplied by 10 because getting a random number with scale results in 0.
-- After getting the random number, we divide it by 1000 to set it back to scale. Dividing affects the shake size as smaller division means higher numbers thus positioning the text label more far.
TextLabel.Position = UDim2.fromScale(randomPosX, randomPosY) -- Setting the position
task.wait(0.1)
end
The script works but for a certain time, after 5-10 seconds using it, doesn’t moves anymore.
Thanks to that, I have tried to remake it and now here’s a version that works.
local TextLabel = script.Parent
local amplitude = 2.5 -- Adjust the amplitude of the shaking
local frequency = 110 -- Adjust the frequency of the shaking
local originalPosition = TextLabel.Position
while true do
local xOffset = math.sin(tick() * frequency) * amplitude
local yOffset = math.sin(tick() * frequency * 1.3) * amplitude
local newPosition = UDim2.new(originalPosition.X.Scale, originalPosition.X.Offset + xOffset, originalPosition.Y.Scale, originalPosition.Y.Offset + yOffset)
TextLabel.Position = newPosition
wait(0.01) -- Cooldown
end