I see, it’s only erroring the first time because it doesn’t have a value when .Changed is initially fired.
Add this to your function to check that the property has a value:
if not sound.SoundId then
return
end
I see, it’s only erroring the first time because it doesn’t have a value when .Changed is initially fired.
Add this to your function to check that the property has a value:
if not sound.SoundId then
return
end
I think it might be an empty string, not nil
, so I would check for the empty string instead. Checking both wouldn’t hurt though.
Sound.Changed:Connect(function()
if not Sound.SoundId or Sound.SoundId == "" then
return
end
-- ...
end)
It worked with it, thank you so much for helping