Hey everyone, hope you’re doing well. I’m making a Sound system with speakers and everything, In the configuration there is a Pitch setting. Now I would like to know if theres any way to set the pitch on a whole sound group instead of the i,v in pairs.
If I use i,v in pairs it only clones 1 pitch and puts it in 1 speaker, I want it to put it in all of the sounds it finds. Could someone help me with this please?
Sorry again if I didn’t make sense like my last post.
(sorry for the messy code, but here it is)
Script
This is the main script at the moment.
local settings = require(script.Parent)
local api = script.Parent.Parent.EAPI
local speakers = script.Parent.Parent.Speakers
local speakers2 = speakers:GetChildren()
local speakeramnt = #speakers2
local Playing = api.Playing.Value
local Queue = api.Queue.Value
local Duration = api.Duration.Value
local Skip = api.Duration.Value
local pitch = Instance.new("PitchShiftSoundEffect")
local pitchclone = pitch:Clone()
print("[zapTech Systems] eAudio Loaded "..speakeramnt.." speaker(s) successfully.")
warn("[zapTech Systems] eAudio Warning, this product is extremely unstable. Major bugs may or will occur during your use of this product.")
for spkr,no in pairs(speakers:GetDescendants()) do
if no:IsA("Sound") then
if settings.Music.PlayOnServerStartup == true then
wait(1)
if settings.Music[Queue]["Audio Settings"].Enabled == true then
pitchclone.Parent = speakers
speakers.PitchShiftSoundEffect.Octave = settings.Music[Queue]["Audio Settings"].Pitch
no.PlaybackSpeed = settings.Music[Queue]["Audio Settings"].PlaybackSpeed
print("[zapTech Systems] eAudio Notice | Audio Configuration set successfully.")
else
print("[zapTech Systems] eAudio Notice | Audio Configuration found disabled, playing audio without any changes.")
end
no.SoundId = settings.Music[Queue].ID
wait(1)
Duration = no.TimeLength
no:Play()
Playing = true
end
end
end
api.Event:Connect(function(funct)
if funct == "Skip" then
for spkr,no in pairs(speakers:GetDescendants()) do
if no:IsA("Sound") then
if Skip == false then
Queue = Queue +1
Skip = true
wait(1)
if settings.Music[Queue]["Audio Settings"].Enabled == true then
pitchclone.Parent = speakers
speakers.PitchShiftSoundEffect.Octave = settings.Music[Queue]["Audio Settings"].Pitch
no.PlaybackSpeed = settings.Music[Queue]["Audio Settings"].PlaybackSpeed
print("[zapTech Systems] eAudio Notice | Audio Configuration set successfully.")
else
print("[zapTech Systems] eAudio Notice | Audio Configuration found disabled, playing audio without any changes.")
end
no.SoundId = settings.Music[Queue].ID
wait(1)
Duration = no.TimeLength
no:Play()
Playing = true
print("[zapTech Systems] eAudio Notice | Audio now Playing on "..spkr.." speaker(s)")
wait(2)
Skip = false
else
print("[zapTech Systems] eAudio Notice | Audio failed to skip on "..spkr.." speaker(s), the Skip value is set true.")
end
end
end
end
if funct == "Play" then
for spkr,no in pairs(speakers:GetDescendants()) do
if no:IsA("Sound") then
wait(1)
if Playing == true then
warn("[zapTech Systems] eAudio Notice | Failed to play audio on "..spkr.." speaker(s), there is an audio already playing.")
else
if settings.Music[Queue]["Audio Settings"].Enabled == true then
pitchclone.Parent = speakers
speakers.PitchShiftSoundEffect.Octave = settings.Music[Queue]["Audio Settings"].Pitch
no.PlaybackSpeed = settings.Music[Queue]["Audio Settings"].PlaybackSpeed
print("[zapTech Systems] eAudio Notice | Audio Configuration set successfully.")
else
print("[zapTech Systems] eAudio Notice | Audio Configuration found disabled, playing audio without any changes.")
end
no.SoundId = settings.Music[Queue].ID
wait(1)
Duration = no.TimeLength
no:Play()
Playing = true
print("[zapTech Systems] eAudio Notice | Audio now Playing on "..spkr.." speaker(s)")
end
end
end
end
if funct == "Pause" then
for spkr,no in pairs(speakers:GetDescendants()) do
if no:IsA("Sound") then
if Playing == true then
no:Pause()
Playing = false
print("[zapTech Systems] eAudio Notice | Audio now paused on "..spkr.." speaker(s)")
else
warn("[zapTech Systems] eAudio Notice | Failed to pause audio on "..spkr.." speaker(s), the audio is already paused or nothing is playing.")
end
end
end
end
end)