Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Not a valid member of model?

There are three sounds L1, L2, and L3. It chooses which one to play with l[math.random(1,3)]

However, I got an error: "L is not a valid member of Model

local randum = math.random(1,3)
local sound = game.Players.Player1.PlayerGui.Options.Effects.Lose.L[randum]
sound:play()

Perhaps this is not the proper way to do this. Any suggestions?

1 answer

✓ Accepted answer

Hi! I saw your question on the Scripters forum (that is not the place where it should go by the way)

It is because L[randum] is trying to find just "randum" instead of "L(randum)". So you would have to do local sound = game.Players.Player1.PlayerGui.Options.Effects.Lose:findFirstChild("L"..randum).

If you have any questions, please comment!

This discussion is preserved as it was. New answers, comments, and votes are closed.