Sound not playing in StarterGui

--typewriter function
function typeWriter(textLabel, text, waitTime, gui)

	textLabel.Text = text --set text
	textLabel.MaxVisibleGraphemes = 0 --set invisible

	for i = 1, #text do
		textLabel.MaxVisibleGraphemes = textLabel.MaxVisibleGraphemes + 1
		gui.dialogueSound:Play()
		wait(waitTime)
	end

end

I believe this is the only relevant part of the script
It’s a typewriter effect function, and everything in it works except for the audio, which makes no sound.
Parameteres:
textLabel = the textlabel im editing
text = the desired text for the typewriter effect
waitTime = the time between different characters appearing
gui = PlayerGui

Make sure you own the audio, roblox has released a new update deleting all sounds or they’re roblox official audios (SFX)

1 Like

its less than six seconds so it shouldnt matter

also i played it in workspace/soundservice and it works fine so why doesnt it work in playergui?

the problem is that the sound can’t play via :Play() unless it’s inside the workspace, what you want to do is use SoundService unless you want everyone to be able to hear the sound in which case it should be placed in a part in the workspace or use a remote event to play the sound locally for all players

https://developer.roblox.com/en-us/api-reference/function/SoundService/PlayLocalSound

You can call :Play() inside of any location, not just workspace & SoundService, so you can have a folder of sounds in StarterGui and it’ll only happen for the client.

yes my apologies i was unsure and went to test for myself and it does indeed work lemme go over the script again

I replicated your script because i thought the idea is quite cool

for i = 1, #script.Parent.TextButton.Text do
script.Parent.TextButton.MaxVisibleGraphemes += 1
script.Parent.Sound:Play()
task.wait(.2)
end

and it works perfectly fine, so i would look into the the settings of the sound instance you are using, perhaps it’s too quiet to hear or the sound is blocked from playing by roblox for one reason or another

I used a roblox made sound i think is quite nice

https://www.roblox.com/library/9120299677/Typewriter-7-SFX?ViewInBrowser=true&CreatorId=1&SearchId=05452280-5B5F-4427-89F6-2CBD805B53AD&Category=Audio&Position=3&SearchKeyword=typewriter&CreatorType=User&SortType=Relevance

this has worked before tho??? like ive been able to play sounds in other places before

yeah this doesnt work lol

character limit