How can I create a script that will play a specific sound at a random time?

So I’ve been re-working my church model recently for one of my games on ROBLOX. I’ve completed everything except the bell part. I have the model ready but need the bell to play a ringing sound randomly between the range of 5-10 minutes.

Basically what I’m trying to achieve is a script that will make my bell model play a ringing sound randomly throughout 5-10 minutes.

I’m aware that this is probably very easy to make, but since I’ve got almost no experience when it comes to scripting I’m unable to make it.

1 Like

use sound.Ended:Wait() and loop it!

this is a tutorial of it
Sound.Ended (roblox.com)

script:

repeat
local allsound = --sound which is in a group
local select = allsound[math.random(1,#allsound)] --this is a sound you get
select:Play()
select.Ended:Wait()
wait()
until false

if you still got a problem then ask me!

1 Like

I understand, but I need it to play everytime in a range of 5-10 minutes, I don’t want it to play only once.

i gave you the code already! go check it!

1 Like
local sound -- path to sound

while sound do
   sound:Play()
   wait(math.random(5,10) * 60) -- it'll either be 5, 6, 7, 8, 9 or 10 minutes exactly
end
1 Like