What it does
This script is meant to put a sound into a folder in workspace and slowly raise the volume until it reaches at certain number.
The issue
So, when I play this script… it does everything correctly except it doesn’t raise the volume of the Volume but instead plays the highest volume instantly.
Tactics I’ve Used
I’ve tried changing through the while () do and repeat multiple times, changing the volume of said sound and it doesn’t work.
NOTE
- Yes, everyone is supposed to be able to trigger this… hence line 15.
- Everything but the volume rising works, I have no idea what i’m doing wrong.
Script itself
--Made By MillerrIAm
--------Variables-------
SoundName = "Cheer"
SSound = game:GetService("ServerStorage").CrowdSounds
WSound = game:GetService("Workspace").CrowdSounds
----------- Messages -----------
msg1 = "c"
msg2 = "C"
msg3 = "cheer"
msg4 = "CHEER"
--------Main Code------
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if msg == msg1 then
if WSound:FindFirstChild(SoundName) then
else
SSound[SoundName].Volume = 0
SSound[SoundName]:Clone().Parent = WSound
WSound[SoundName]:Play()
repeat
WSound[SoundName].Volume = WSound[SoundName].Volume + 1
wait(0.5)
until WSound[SoundName].Volume == 1
wait(10)
WSound[SoundName]:Stop()
WSound[SoundName]:Destroy()
end
end
end)
end)
Error Line
-- This is the section of the script that I'm having issues with. Line 20 to 23.
repeat
WSound[SoundName].Volume = WSound[SoundName].Volume + 1
wait(0.5)
until WSound[SoundName].Volume == 1
Last Words
Thank you to anyone who takes the time to look over this and help me achieve my goal for this.