Hi so I have this script in StarterGui
-- Local Script cam = game.Workspace.CurrentCamera minheight = -20.5 -- height (in studs) before it plays the deep sound sound = script.Parent.CreakingNoises -- location of the sound (put it somewhere on the client like StarterGui) deepsound = "rbxassetid://200404653" -- the sound of when the sub is deep shallowsound = "rbxassetid://282286147" -- the sound of when the sub is in shallow sound.Looping = true while true do if cam.CoordinateFrame.Position.Y <= minheight then sound:Stop() sound.SoundId = deepsound sound:Play() else sound:Stop() sound.SoundId = shallowsound sound:Play() end end
But it gives me this error Looping is not a valid member of Sound Has anyone got an idea what Im doing wrong?
An easy fix, Looping
is not an actual property of Sound.
Its actually Looped
sound.Looped = true while true do if cam.CoordinateFrame.Position.Y <= minheight then sound:Stop() sound.SoundId = deepsound sound:Play() else sound:Stop() sound.SoundId = shallowsound sound:Play() end end
https://developer.roblox.com/en-us/api-reference/class/Sound