What do you want to achieve?
I am trying to detect when a player is talking in VC through an Audio Device Input
What is the issue?
For some reason, when the code runs, it doesn’t create the new instance, or the wire, and it doesn’t parent it to the player. Im running it through a Server Script, and I have checked on both the client and the server, as well as running the same script through command line, yet it still does not work, and does not throw errors.
for _, plr in game:GetService('Players'):GetPlayers() do
if plr:FindFirstChild('AudioDeviceInput') then
local audiodeviceinput = plr.AudioDeviceInput
local Analyzer = Instance.new("AudioAnalyzer")
Analyzer.Name = plr.Name
Analyzer.Parent = game.ReplicatedStorage.Shared.Analyzers
local Wire = Instance.new("Wire")
Wire.Parent = Analyzer
Wire.SourceInstance = audiodeviceinput
Wire.TargetInstance = Analyzer
end
end
check players exist in the game when the code runs
add prints; if you print an instance and click on it then you can automatically go to it in the explorer and if it doesnt go anywhere then the instance parent is nil
print("running")
for _, plr in game:GetService('Players'):GetPlayers() do
print("player", plr)
if plr:FindFirstChild('AudioDeviceInput') then
print("passed")
local audiodeviceinput = plr.AudioDeviceInput
local Analyzer = Instance.new("AudioAnalyzer")
Analyzer.Name = plr.Name
Analyzer.Parent = game.ReplicatedStorage.Shared.Analyzers
local Wire = Instance.new("Wire")
Wire.Parent = Analyzer
Wire.SourceInstance = audiodeviceinput
Wire.TargetInstance = Analyzer
print(Analyzer, Wire)
end
end