I have a script that needs to play a sound when typing in text is done and enter is pressed. But it currently doesn't work as thought, instead it plays a random sound when the "sound origin" is spawned.

local txtbox = script.Parent.Parent.ask
local snd = game.Workspace.Ben.sounds

local sounds = {snd.Yes, snd.No, snd.Augh, snd.Nah, snd.Hohoho}

if txtbox.Text ~= "" then
	return
else
	local plrn = sounds[math.random(1, #sounds)]
	plrn:Play()
end

2 comments

0

Dude, I just can't tell you how grateful I am. I had my code in basic script...