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

Play() weird error?

Hi guys!

function playgamesong()
	local gamesong = game.Workspace.GameMusic:GetChildren()
	randomgamesong = gamesong[math.random(1,#gamesong)]
	randomgamesong:Play()
end

This function usually works, but when I run it, it randomly says: Play( )is not a valid member of playgamesong()

Any ideas? Thanks

2 comments

0

Try printing the ClassName of randomgamesong and see what it says if the error shows up.

0

Okay, this script is inside the model where you're playing it. and it will try to play the script which it can't.

1 answer

Only idea I can think is there's a child inside the model that's not a sound.

2 comments

0

Nope :/

0

try to put the sound in workspace and redo the script

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