I’m currently making a debating game inspired by Phoenix Wright (all original assets of course!)
however, what i need is a beep sound to play whenever a letter is written onto the GUI like this
Problem is, it only plays the sound on the first word, and then stops completely.
Below is the script i’m using to make a typewriter effect
local Beep = game.ReplicatedStorage["Beep!"]
local playerObjection = game.Workspace.playerObjection
playerObjection = false
wait(1)
local playerText = {
"Hello",
"I am here to debate the following topic!",
"Should developers be allowed to DevEx...",
"For less?"
}
local textDisplay = script.Parent
local function typewrite(object, text)
for i = 1, #text, 1 do
Beep:Play()
object.Text = string.sub(text, 1, i)
wait(0.05)
end
end
for i, v in pairs(playerText) do
typewrite(textDisplay, v)
wait(3)
end
Not sure if this would fix your issue, but I think you should move the sound to Workspace instead of ReplicatedStorage
Also, I would add this to the typewrite function:
local function typewrite(object, text)
for i = 1, #text, 1 do
Beep:Play()
object.Text = string.sub(text, 1, i)
wait(0.05)
Beep:Stop() -- add this
end
end
I tested this myself and I seem to be getting different results depending on which Audio I try. I noticed that if your audios TimePosition is set to anything but 0, say over the audios length, the next word, it will glitch / not play. So keep the code you have but set the TimePosition property in the Sound Instance to 0 and see if that works? (Worked for me.)
considering the original audio was 0.17777 (recurring) seconds, i’m starting to think that its probably to quick of an audio, since my time position is always set at 0
I’ve replicated and tested everything in your LocalScript, even with a faster beep sound and even placing it in a TextBox, child to a Frame, child to a StarterGUI.
It works absolutely fine for me, so I’m unsure what could be wrong? How about I send you a replica of of the working version?
If this doesn’t work, then something must be wrong with your Studio or Roblox: for_cool_kid.rbxl (25.8 KB)