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

How do I make a OnTouch Seat Sound script loop?

Asked by 6 years ago

I am developing a plane in which when you sit in the the seat it plays an audio. I have figured out how to make the audio play... but it will not loop. Here's my script that I need help with. What should I do? Thank you.

local sp = script.Parent

sp.ChildAdded:connect(function(weld)
    I = Instance.new("Sound", Workspace)
    I.SoundId = "http://www.roblox.com/asset/?id=142317661"
    I.Volume = 1.0
    I.Pitch = 1.1
    I:Play()
    while true do 
        if not sp:findFirstChild(weld.Name) then 
            I:Stop()
            I:Destroy()
            break
        end
        wait()
    end
end)


0
Remember, try to replace infinite loops with events. In this case, you can, but I'll give you a challenge to see if you know what event to use. hiimgoodpack 2009 — 6y

Answer this question