Attempt to get length of a Instance value

code:

local song = workspace.IntermissionSong
local IntermissionMusicIds = {
	[1] = 1841151748,
	[2] = 10204750154,
	[3] = 10402914525,
	[4] = 10912090869,
	[5] = 10912056711,
	[6] = 10912044282,
	[7] = 10912033435
}
local ChosenSong = IntermissionMusicIds[math.random(1, #song)]
song.SoundId = "rbxassetid://"..ChosenSong

i have no clue why it doesn’t work.

You are attempting to get the length of IntermissionSong, which isnt a table, # only works with strings, an tables

local ChosenSong = IntermissionMusicIds[math.random(1, #IntermissionMusicIds)]
1 Like

whoops! rookie mistake. not sure how i didn’t see that.

If this solved your issue, make sure you mark it as the solution, rather than leaving the Topic open

i didn’t test it yet. i was doing something.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.