what i am trying to say that theres a zombie and when i kill it or when it dies it plays a sound from a list of sounds in the script like this
{ID,ID,ID,ID}--When Zombie Dies Plays one of the random sound id's
what i am trying to say that theres a zombie and when i kill it or when it dies it plays a sound from a list of sounds in the script like this
{ID,ID,ID,ID}--When Zombie Dies Plays one of the random sound id's
this plays a random song id whenever a zombie dies..
math.randomseed(tick()) -- makes sure when you constantly replay the game, their will be a different sound
local Zombie = -- your zombie's head...
if Zombie == nil then
local a = -- Song ID
local b = -- Song ID
local c = -- Song ID
local d = -- Song ID
local e = -- Song ID
local ZombieVoice = Instance.new("Sound", Zombie)
ZombieVoice.SoundId = math.random(a,b,c,d,e)
end
I hope this worked, thank you if you accept answer
this wont work, it will run this once as soon as the server starts, and only once, if a zombie does not die at the moment it runs, nothing will happen.
unlike many other programmig languages, LUA does not loop the same script over and over.
I know idiot, he made me go to his team create and i made the script so shut up, i am f... pissed rn.. i used a while wait() do, now please get those comments out of the chat, they are bugging the crap outta me
math.random
Perhaps, putting the variables [of sounds] on a table. In which, you can use that math.random with respect to the table you just implemented.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
their is no such thing as random.math :P