im trying to make my own sound system but this error i could not fix
attempt to get length of a userdata value
14:19:38.318 - Stack Begin
14:19:38.321 - Script 'ServerScriptService.SoundCaller', Line 9
14:19:38.322 - Stack End
Here is the code:
local Module = require(game.ReplicatedStorage:WaitForChild("SoundPlayer"))
while wait(0.5) do
local Sounds = game.ServerStorage.Sounds:GetDescendants()
for _, Sond in pairs(Sounds) do
local sound = math.random(1, #Sond)
print(sound.Name) -- prints the name of the sound
sound:Play() -- plays the sound
end
-- [[ if randomSong:IsA("Sound") then
--local ClonedSong = randomSong:Clone()
--ClonedSong.Parent = workspace.Sound
--Module:PlaySong(ClonedSong)
--wait(randomSong.TimeLength)
--Module:DestroySong(ClonedSong)
-- ]] end
end