Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I play random sound if input was made into textbox?

Asked by 2 years ago

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
0
Dude, I just can't tell you how grateful I am. I had my code in basic script... mlgfoxydan 14 — 2y

Answer this question