I'm trying to make this script play random music each time, But It Won't Work any Suggestions or ideas? What did I do wrong?
local X = math.random(5)
local BaseUrl = "http://www.roblox.com/asset/?id="
if X == 1 then
script.Parent.menu_sfx_audio.SoundId = BaseUrl.."199768665"
wait(.5)
script.Parent.menu_sfx_audio.Play()
else if X == 2 then
script.Parent.menu_sfx_audio.SoundId = BaseUrl.."199768665"
wait(.5)
script.Parent.menu_sfx_audio.Play()
else if X == 3 then
script.Parent.menu_sfx_audio.SoundId = BaseUrl.."199768665"
wait(.5)
script.Parent.menu_sfx_audio.Play()
else if X == 4 then
script.Parent.menu_sfx_audio.SoundId = BaseUrl.."167135038"
wait(.5)
script.Parent.menu_sfx_audio.Play()
else if X == 5 then
script.Parent.menu_sfx_audio.SoundId = BaseUrl.."185601181"
wait(.5)
script.Parent.menu_sfx_audio.Play()
end

3 comments
Incorrect Syntax's: Lines 7-22; It should be 'elseif', and to call a method, you should use a Colon ':' (E.x. 'Sound:Play()').
Just change . for : like I do -.-
And change else if for elseif