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

Not a valid member of model?

Asked by 10 years ago

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

Log in to vote
0
Answered by
aalok 20
10 years ago

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!

Ad

Answer this question