I am making a part based main menu and i need help to make the active signal activate after the typewriting effect with audio like what’s in the video, also a typewriting script with sound effects.
I am recreating this:
I am making a part based main menu and i need help to make the active signal activate after the typewriting effect with audio like what’s in the video, also a typewriting script with sound effects.
I am recreating this:
To create a typewriting effect with sound effects (SFX) and an active signal with SFX in Roblox Lua (Luau), you can use a combination of the Sound and TextService services.
Here’s an example code that demonstrates how you can achieve this:
-- create a Sound object for the typewriter sound effect
local typewriterSFX = Instance.new("Sound")
typewriterSFX.SoundId = "rbxassetid://SOUND_ID_HERE" -- replace with the ID of your sound effect
typewriterSFX.Volume = 0.5 -- set the volume of the sound effect
-- create a Sound object for the active signal sound effect
local activeSignalSFX = Instance.new("Sound")
activeSignalSFX.SoundId = "rbxassetid://SOUND_ID_HERE" -- replace with the ID of your sound effect
activeSignalSFX.Volume = 0.5 -- set the volume of the sound effect
-- create a TextLabel to display the typewriter text
local typewriterTextLabel = Instance.new("TextLabel")
typewriterTextLabel.Text = "Type out this text with sound effects!"
typewriterTextLabel.Font = Enum.Font.SourceSans
typewriterTextLabel.TextSize = 24
typewriterTextLabel.TextColor3 = Color3.new(1, 1, 1)
typewriterTextLabel.BackgroundTransparency = 1
typewriterTextLabel.TextXAlignment = Enum.TextXAlignment.Left
typewriterTextLabel.TextYAlignment = Enum.TextYAlignment.Top
typewriterTextLabel.Size = UDim2.new(1, 0, 1, 0)
typewriterTextLabel.Parent = script.Parent -- replace with the parent object of your GUI
-- function to play the typewriter sound effect
local function playTypewriterSFX()
typewriterSFX:Play()
end
-- function to play the active signal sound effect
local function playActiveSignalSFX()
activeSignalSFX:Play()
end
-- function to display the typewriter text with a typewriting effect
local function typeOutText(text)
local textLength = string.len(text)
local currentIndex = 0
typewriterSFX:Play()
while currentIndex < textLength do
currentIndex = currentIndex + 1
local currentText = string.sub(text, 1, currentIndex)
typewriterTextLabel.Text = currentText
wait(0.05) -- adjust the wait time to change the speed of the typewriting effect
end
typewriterSFX:Stop()
playActiveSignalSFX()
end
-- call the typeOutText function with your desired text
typeOutText("Type out this text with sound effects!")
In this example code, we create two Sound objects, one for the typewriter sound effect and one for the active signal sound effect. We also create a TextLabel to display the typewriter text.
The typeOutText
function takes a string parameter and displays the text with a typewriting effect by incrementally adding one character at a time to the TextLabel. As each character is added, the typewriter sound effect is played using the playTypewriterSFX
function. Once the entire text has been typed out, the active signal sound effect is played using the playActiveSignalSFX
function.
You can customize the sound effects and adjust the wait time in the typeOutText
function to achieve the desired effect.
Thank you very much, that helps alot, but like in the video, how can i make the active word pop up in time with the active sound, same thing with the red bar turning to green?
also ive put it in and its not working, ive done what the instructions said, its a surface gui with the text label inside
Pardon me read the message wrong
its all good lmao
CHARACTER LIMIT
Any errors? Also, if I’m getting this right, are you using an already existing one? Since by what I can see the script makes a new label and frame itself. (The script needs to be inside any type of GUI)
Also just to complete @VariantBD’s code. After the typewritter effect, so after typeOutText("Type out this text with sound effects!")
you just need to call the same function you are currently calling for the alarm.
In case the game is not yours and you want to mimic the effect I recommend turning the surface material Neon and back to plastic/other:
--Typewritter shenanigans
--Assuming there is a variable called 'alarm'
local repeatAmount = 5
local originalMaterial = alarm.Material;
for i=1,repeatAmount do --Repeat the amount of times 'repeatAmount' is set
alarm.Material = Enum.Material.Neon; --Make it shine
task.wait(1); --Wait 1 second
alarm.Material = originalMaterial; --Reverse the effect
task.wait(2); --Wait two seconds; Why? Well because in the video it seems it's shorter when it's bright. You can change any time you want
end
Yes, I though it would use an existing text label, that’s probably why lol, anyway can you make it use an existing one, I already have all the surface guis and text labels created, the menu itself is ready just needs the scripting
Put the script inside the Surface GUI:
-- create a Sound object for the typewriter sound effect
local typewriterSFX = Instance.new("Sound")
typewriterSFX.SoundId = "rbxassetid://SOUND_ID_HERE" -- replace with the ID of your sound effect
typewriterSFX.Volume = 0.5 -- set the volume of the sound effect
-- create a Sound object for the active signal sound effect
local activeSignalSFX = Instance.new("Sound")
activeSignalSFX.SoundId = "rbxassetid://SOUND_ID_HERE" -- replace with the ID of your sound effect
activeSignalSFX.Volume = 0.5 -- set the volume of the sound effect
-- the TextLabel to display the typewriter text
local typewriterTextLabel = PUT_THE_PATH_HERE
-- function to play the typewriter sound effect
local function playTypewriterSFX()
typewriterSFX:Play()
end
-- function to play the active signal sound effect
local function playActiveSignalSFX()
activeSignalSFX:Play()
end
-- function to display the typewriter text with a typewriting effect
local function typeOutText(text)
local textLength = string.len(text)
local currentIndex = 0
typewriterSFX:Play()
while currentIndex < textLength do
currentIndex = currentIndex + 1
local currentText = string.sub(text, 1, currentIndex)
typewriterTextLabel.Text = currentText
wait(0.05) -- adjust the wait time to change the speed of the typewriting effect
end
typewriterSFX:Stop()
playActiveSignalSFX()
end
-- call the typeOutText function with your desired text
typeOutText("Type out this text with sound effects!")
Change PUT_THE_PATH_HERE
as well as all the sound ids
Ok I’ll test it later, thank you
@STORMGAMESYT7IP I got it working, i just put it into a script instead of a local script, only problem is the sounds dont play…i replaced the ids
That’s weird, it’s meant to work with a local script. Are there any errors?
I didn’t check, but ill look in the output section while testing.
Also perhaps I invite you to my team create session, you can help me figure this out? also not only that, I can offer you a dev position, as its extremely difficult developing a game solo with no scripting knowledge, but basics. It would really help and I would really appreciate it
I’d love to but sadly currently I have a lot of projects going on, sorry! But in relation to the errors, were there any?
That’s all good, and yes there were errors but overall those errors are ok and they were the SFX, I just used my knowledge to create a separate script to make the audios wait a certain time limit and managed to get it in sync
Currently typing this from my phone, so sorry if some things don’t seem clear.
It seems that in the video, the text is built using neon parts.
What you can do is have all of them be transparent, and then use a function to make them appear.
That function will select a random child within a table that holds the model’s children, and then set that part’s transparency to 0 and also play a sound, and remove it from the table so it won’t be selected again.
local TextModel = workspace.TextModel
local Sound = script.TypeSound
local FinishSound = script.FinishSound
local function TypeText(Model)
local Children = Model:GetChildren()
for _ = 1,#Children do
local i = math.random(1,#Children)
local Part = Children[i]
table.remove(Children,i)
Part.Transparency = 0
if i == #Children then
FinishSound:Play()
else
Sound:Play()
end
task.wait(0.05)
end
end
TypeText(TextModel)