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

Concatenate an object location?

Asked by 7 years ago

I'm having troubles finding a solution to concatenating an object location with a math.random value in a table, so I can use the concatenated object location to check a value in it, being an ID. When the script shown below is run, it says the concatenated text as is, without actually getting the value. I am at a loss.

Workspace.Music.PickSongScript:18: attempt to concatenate field 'Radio' (a userdata value)

from :

SongID = {StorageGroup.Radio ..".G."..CurrentSongGroup[1] .. ".S" .. CurrentSong[1] .. ".ID ="}

Entire script excluding variables

CurrentSongGroup = {(math.random(1,5)),}
print(CurrentSongGroup[1])
CurrentSong = {(math.random(1,10)),}
print(CurrentSong[1])
wait(.1)
** Error Here**SongID = {StorageGroup.Radio ..".G."..CurrentSongGroup[1] .. ".S" .. CurrentSong[1] .. ".ID ="}
SongArtist = {Storage_Location.Radio ..".G".. CurrentSongGroup[1] .. ".S" .. CurrentSong[1] .. ".Artist ="}
SongName = {Storage_Location.Radio ..".G"..CurrentSongGroup[1] .. ".S" .. CurrentSong[1] .. ".Name ="}
RadioID = SongID[1]
wait(.1)
SongLength = {Radio.TimeLength}
wait(.01)
MusicFolder.Current.Length.Value = SongLength[1]
MusicFolder.Current.Artist.Value = SongArtist[1]
MusicFolder.Current.SName.Value = SongName[1]
MusicFolder.Current.ID.Value = SongID[1]

print(SongName[1] .. " By " .. SongArtist[1] .. " Time Until Finish " .. SongLength[1])
wait(SongLength[1])
1
If StorageGroup.Radio is an Instance then it can't be included in a string. Use Radio.Name , or tostring(). cabbler 1942 — 7y

Answer this question