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

Help! Why does math.random always return the same value on a plugin? Multiple methods all fail

whats happening is when the plugin is launched it chooses from several songs, however each time it launches it picks the same song each time, I have tried math.randomseed with different values ("ie, mathrandom(tick())") but they dont work

local PLAYLIST = {"rbxassetid://##########","rbxassetid:///##########","rbxassetid:///##########","rbxassetid:///##########","rbxassetid:///##########"}
math.randomseed(tick())
local SONG = PLAYLIST[math.random(5, #PLAYLIST)]

here is the code used right now

this is an on going bug that is hampering me so any assistance is appreciated!

1 comment

0

try math.random(1,#PLAYLIST)

1 answer

Its always the last song of the table that is palying right? Because your math.random cmd is running through which song in the table to play, and only has one option -> the 5th song

local SONG = PLAYLIST[math.random(1, #PLAYLIST)]

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