Scripting Moderators ds1-e Posted April 24, 2019 Scripting Moderators Share Posted April 24, 2019 Hey. Some weird thing. I wanted to make songs play in login panel randomly, but it doesn't work. It plays only 3 songs, but in total there's 7 songs. local loginSounds = {"music1", "music2", "music3", "music4", "music5", "music6", "music7"} function onClientResourceStart() local random = math.random(1, 7) loginMusic = playSound("files/"..loginSounds[random], true, false) end addEventHandler("onClientResourceStart", resourceRoot, onClientResourceStart) I didn't even count how much times i reconnected to check if all songs are playing. I don't know if it's my code mistake, but after restarting script all songs can play, not only 3 of them. Link to comment
Moderators IIYAMA Posted April 24, 2019 Moderators Share Posted April 24, 2019 (edited) math.randomseed(getTickCount() * getTickCount()) Be × random as much as you want, play with the input of this function. But do not call it too much, it is a heavy operation. Edited April 24, 2019 by IIYAMA 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now