Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Looping is not a valid member of Sound?

Asked by 4 years ago

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?

1 answer

Log in to vote
0
Answered by
Psudar 882 Moderation Voter
4 years ago

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

Ad

Answer this question