My problem is that my script, even when the script is activated, even when there are no errors, will not play any sound (volume on sound instances, local volume, and studio volume are all 100%)
I used the solution from this topic to fix my issue but it did not work. I am facing the same issue, no sound is playing. There is the code below:
while wait(1) do
local item = workspace.Rumbling:GetChildren()
local randomitem = item[math.random(1, #item)]
randomitem:Play()
end
I would upload a video but it just won’t work, sorry.
P.S: I know it’s gonna be some silly oversight (like most of my issues) but I seriously have no idea what I’m doing wrong.
Hey, since you’re playing a sound every second, if there’s just a few sounds inside the folder, it might be that the script is continuously calling :Play() on a sound that hasn’t actually started playing.
For example if your sounds last 30 seconds and gets progressively louder, the volume of the sound at the first ~3 seconds might just be too low to be noticeable.
If you send me a demo place file with the sounds, I could try looking into it for you!
TimeLength is also part of the sound loading functionality.
Try this instead,
while wait(1) do
local item = workspace.Rumbling:GetChildren()
local randomitem = item[math.random(1, #item)]
if not randomitem.IsLoaded then
randomitem.Loaded:Wait()
end
randomitem:Play()
end
The code I have mentioned in the post is server sided code, the code doesn’t seem to be working. Same issue, no errors are present either, some of the logic is still broken. Would you like a demo place file to see what issue I’m having?
By the way, it is not a computer glitch. The footsteps, death, and jumping sounds all work fine.
local item = workspace.Rumbling:GetChildren()
local randomitem = item[math.random(1, #item)]
local cln = randomitem:Clone()
cln.Parent = workspace
cln:Play()
game.Debris:AddItem(cln,cln.TimeLength)
end
Oh my goodness, what a silly problem!
I had put this loop, AFTER, I made a “while true do” loop.
I figured this out trying to make a demo place, I realised my mistake then and there.
Thanks for helping me out @oSudden@Callum_Cloth@T3_MasterGamer and @Actulurus. I’ll select the solution now.
By the way, @oSudden and @Callum_Cloth’s code worked with equal success.