Sound

Artık kullanılmayanları göster

*Bu içerik, yapay zekâ (beta) kullanılarak çevrildi ve hatalar içerebilir. Sayfayı İngilizce görüntülemek için buraya tıkla.

Bir Sound bir ses yayan bir nesnedir.

2D ve 3D Ses

Bir sesi BasePart veya bir Attachment içine yerleştirilen bir ses,

Bir ses BasePart veya Attachment ile ilgili değilse "küresel" olarak kabul edilir. Bu durumda, ses aynı hacimde tüm dünyaboyunca oynatılır.

Kod Örnekleri

The code in this sample demonstrates how a sound parented to a Part or Attachment will play locally and experience volume drop off the further the player's camera is away from the part.

A part is instanced, and a sound is instanced and parented to the part. A click detector is set up on the part that will check if the sound is playing, using Sound.IsPlaying and play or stop the sound depending.

Music Playing Part

local part = Instance.new("Part")
part.Anchored = true
part.Position = Vector3.new(0, 3, 0)
part.BrickColor = BrickColor.new("Bright red")
part.Name = "MusicBox"
part.Parent = workspace
-- create a sound
local sound = Instance.new("Sound", part)
sound.SoundId = "rbxassetid://9120386436"
sound.EmitterSize = 5 -- decrease the emitter size (for earlier volume drop off)
sound.Looped = true
sound.Parent = part
local clickDetector = Instance.new("ClickDetector")
clickDetector.Parent = part
-- toggle the sound playing / not playing
clickDetector.MouseClick:Connect(function()
if not sound.IsPlaying then
part.BrickColor = BrickColor.new("Bright green")
sound:Play()
else
part.BrickColor = BrickColor.new("Bright red")
sound:Stop()
end
end)

This sample gives a simple example of how a Sound that is not parented to a Part or Attachment will play at a constant volume throughout the place. A sound is instanced and parented to the Workspace, and then played.

Sound in the Workspace

local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://9120386436"
sound.Looped = true
sound.Parent = workspace
sound:Play()

Özet

Özellikler

  • Salt Okunur
    Çoğaltılmamış
    Gezilemez
    Roblox Betik Güvenliği
    Paralel oku
  • Salt Okunur
    Çoğaltılmamış
    Paralel oku

    Bu özellik, Sound adlı öğenin Roblox sunucusundan yüklenmiş olması ve oynamaya hazır olması durumunda doğrudur.

  • Gizli
    Salt Okunur
    Çoğaltılmamış
    Paralel oku

    Bu okuma yalnızca özellik Sound çalıştığında geri dönecektir.

  • Gizli
    Salt Okunur
    Çoğaltılmamış
    Paralel oku

    Bu sadece okuma özelliği, Sound çalınırken geri dönecektir.

  • Class.Sound.PlaybackRegion içindeki istediğiniz bir dizi başlangıcı ve dizi sonunu gösteren bir menzil.

  • Paralel oku

    Bu, Sound'in oynadığında bittiğinde tekrarlanıp tekrarlanmayacağını ayarlar.

  • Paralel oku

    Doğruysa, Sound oyundan kaldırıldığında çalır, Sound ya da onun atalarından biri ile yuva edinir.

  • Salt Okunur
    Çoğaltılmamış
    Paralel oku

    Class.Sound ın şu anda ne kadar yüksek ses çıkardığını gösteren bir sayı. 0 ile 1 arasında bir geri.

  • Bir Class.Sound.TimeLength içinde, saniye içinde istediğiniz başlangıcı (min) ve durdurma (max) süresini gösteren bir menzil.

  • Eğer doğru , bu özellik, Sound 'ınızın Sound.PlaybackRegion ve 2> Class.Sound.LoopRegion2> özelliklerine erişimini sağlar, bu da onun oynatma tarzını daha doğru kontrol edebilir.

  • Çoğaltılmamış
    Paralel oku

    Bir Sound ın oynayacağı hızı belirler, daha yüksek değerler yüzünden sesin daha hızlı ve daha yüksek bir tonla oynatılmasını sağlar.

  • Çoğaltılmamış
    Paralel oku

    Şu anda Sound oynadığını gösterir.

  • Maksimum mesafe, özelliklerinin içindeki <a href="/reference/engine/datatypes">özellikler</a> içinden ve hala duyulabilir. Sadece <c>Class.Part</c> veya <c>Class.Configuration</c> ile ilgili sesler için geçerlidir (3D sesler).

  • 3D bir Sound (doğrudan bir BasePart veya Attachment çocuğu) başlayacak azalmaya başlayacak (hacimde azalma).

  • Bir 3D Sound (ebeveyni bir BasePart ile veya bir Attachment ile değiştirilmiş olup) kontrol etmez, sesin ebeveyni değiştiren mesafenin arttığına göre davranır.

  • Bu ses grubuna bağlanan SoundGroup . Ses efektleri, ses grubuna uygulanan Volume ve SoundEffects'ler sese geçer. Bir ses grubu sadece bir ses grubunda olabilir.

  • SoundId:ContentId
    Paralel oku

    Bu özellik, Sound nesnelerinin içeriğiyle ilgili bir ses dosyasının içeriğidir. Bir ses yüklenmiş olduğunda, içeriği Roblox'a yüklenmiş sesin URL'sinde bulunabilir.

  • Salt Okunur
    Çoğaltılmamış
    Paralel oku

    Class.Sound 'in saniye içindeki uzunluğu. Sound yüklenmediyse bu değer 0 olur.

  • Çoğaltılmamış
    Paralel oku

    Class.Sound . İçerik içinde önbelleğe alınır ve oynatılır. Oynatma sırasında içerik önbelleğinden kaldırılır ve oynatılmaz.

  • Paralel oku

    Class.Sound . Sesin oranını ayarlayabilirsiniz. Standart, 0.5'tir.

Yöntemler

  • Pause():void

    Class.Sound.Playing ı false olarak ayarlar. Bu, sesin çalıyor olduğu durumda Sound ın oynatılmasını durdurur. Sound.TimePosition , 1> Class.Sound1> ın yeniden başlatılmasından sonra devam edecektir.

  • Play():void

    Oynar Sound . Set Sound.TimePosition ile son değeri ayarlar ve ardından Script (ya da 0 değilse) ile 1> Class.Sound.Playing1> ını ayarlar.

  • Resume():void

    Resumes the Sound . Sets Sound.Playing to true. Does not alter Sound.TimePosition and thus can be used to resume the playback of a sound stopped using 1> Class.Sound:Pause()1> .

  • Stop():void

    Class.Sound durdurur. Sound.Playing değerini false olarak ayarlar ve Sound.TimePosition değerini 0 olarak ayarlar.

Etkinlikler

Özellikler

ChannelCount

Salt Okunur
Çoğaltılmamış
Gezilemez
Roblox Betik Güvenliği
Paralel oku

IsLoaded

Salt Okunur
Çoğaltılmamış
Paralel oku

Bu özellik, Sound adlı öğenin Roblox sunucusundan yüklenmiş olması ve oynamaya hazır olması durumunda doğrudur.

Roblox'ta, ses dosyaları oyunların kendilerine değil Roblox sunucularına saklanır ve Sound.SoundId özelliği tarafından işaret edilir. Bu, seslerin oynatılabilir olması için kliğinizin bir cihazına indirilmesi gerektiğini ifade eder. Bu, kullanıcının internet bağlantıs

Geliştiriciler, bir sesi oynatmadan önce bir sesin yüklendiğinden emin olmak için Sound.IsLoaded ve Sound.Loaded etkinliğini kullanabilir.

Kod Örnekleri

This simple function will verify a Sound has loaded by checking the Sound.IsLoaded property. If Sound.IsLoaded is false it will wait for the Loaded event before resuming.

It is important to check Sound.IsLoaded before connecting to the Sound.Loaded event, as if the sound has already loaded the Sound.Loaded event will not fire and the function will yield indefinitely.

Load Sound

local sound = script.Parent.Sound
if not sound.IsLoaded then
sound.Loaded:Wait()
end
print("The sound has loaded!")

IsPaused

Gizli
Salt Okunur
Çoğaltılmamış
Paralel oku

Bu yalnızca okuma için özellik olarak geri dönecektir, Sound öğesi durduğunda. Not et ki, bu öğütün sadece bir ses askıya alındığında durduğunda geri dönecektir, ama asla Sound:Pause() işlevini kullanarak askıya alınmış olmayan bir sesi durdurmayacaktır.

Bu özellik yalnızca Sound.IsPlaying doğru olduğunda gerçekleşir.

As IsPaused okunurken, sesi durdurmak için kullanılamaz, Sound:Stop() ve Sound:Pause() yerine kullanılmalıdır.

Kod Örnekleri

This code sample contains demonstrates when the Sound.IsPlaying and Sound.IsPaused properties will be true or false.

A sound is instanced in the Workspace and the Sound.IsLoaded property is checked to ensure it has loaded, if it has not the Sound.Loaded event is used to yield the script until the sound has.

As the sound is played, paused and stopped the Sound.IsPlaying and Sound.IsPaused properties are printed to demonstrate how they respond to each of these functions. Note Sound.IsPaused will always be true if even if the sound has been stopped rather than paused.

Sound IsPlaying and SoundIsPaused

local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://9120386436"
sound.Looped = true
sound.Parent = workspace
if not sound.isLoaded then
sound.Loaded:Wait()
end
sound:Play()
print(sound.IsPlaying, sound.IsPaused) -- true, false
task.wait(2)
sound:Pause()
print(sound.IsPlaying, sound.IsPaused) -- false, true
task.wait(2)
sound:Play()
print(sound.IsPlaying, sound.IsPaused) -- true, false
task.wait(2)
sound:Stop()
print(sound.IsPlaying, sound.IsPaused) -- false, true

IsPlaying

Gizli
Salt Okunur
Çoğaltılmamış
Paralel oku

Bu sadece okuma özelliği, Sound çalınırken geri dönecektir.

Bu özellik yalnızca Sound.IsPaused değerinde gerçekleştirilebilir.

As IsPlaying okuma yalnızca sesi çalmak için kullanılamaz, Sound:Play() bunun yerine kullanılmalıdır.

Kod Örnekleri

This code sample contains demonstrates when the Sound.IsPlaying and Sound.IsPaused properties will be true or false.

A sound is instanced in the Workspace and the Sound.IsLoaded property is checked to ensure it has loaded, if it has not the Sound.Loaded event is used to yield the script until the sound has.

As the sound is played, paused and stopped the Sound.IsPlaying and Sound.IsPaused properties are printed to demonstrate how they respond to each of these functions. Note Sound.IsPaused will always be true if even if the sound has been stopped rather than paused.

Sound IsPlaying and SoundIsPaused

local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://9120386436"
sound.Looped = true
sound.Parent = workspace
if not sound.isLoaded then
sound.Loaded:Wait()
end
sound:Play()
print(sound.IsPlaying, sound.IsPaused) -- true, false
task.wait(2)
sound:Pause()
print(sound.IsPlaying, sound.IsPaused) -- false, true
task.wait(2)
sound:Play()
print(sound.IsPlaying, sound.IsPaused) -- true, false
task.wait(2)
sound:Stop()
print(sound.IsPlaying, sound.IsPaused) -- false, true

LoopRegion

Paralel oku

Bir sesin Sound.PlaybackRegion içindeki istediğiniz bir döngü başlangıcı ve döngü sonu içindeki bir döngü için kullanılabilir bir menzil.

Looped

Paralel oku

Bu, Sound'in oynadığında bittiğinde tekrarlanıp tekrarlanmayacağını ayarlar.

Tekrarlanan sesler müzik ve arka plan çevre sesleri dahil olmak üzere bir dizi uygulama için uygundur. Sound.DidLoop etkinliği, sesin kaç kere tekrarlandığını izlemek için kullanılabilir.

Kod Örnekleri

Whilst looping is most appropriate for longer tracks such as music or ambient sounds, this sample demonstrates sound looping by creating the Roblox death sound in every character's head and looping it.

The Players.PlayerAdded and Player.CharacterAdded functions are used to detect new player characters. One a new character has been added a sound is created in their head. For demonstration purposes, the Sound.DidLoop function is used to show how the number of times a particular sound has looped can be tracked.

Sound Looping

local Players = game:GetService("Players")
local function onPlayerAdded(player)
local function onCharacterAdded(character)
-- wait for the head to be added
local head = character:WaitForChild("Head")
local sound = Instance.new("Sound")
sound.Name = "TestSound"
sound.SoundId = "rbxasset://sounds/uuhhh.mp3" -- oof
sound.Parent = head
sound.Looped = true
sound.DidLoop:Connect(function(_soundId, numOfTimesLooped)
print("oof! " .. tostring(numOfTimesLooped))
end)
sound:Play()
end
player.CharacterAdded:Connect(onCharacterAdded)
end
Players.PlayerAdded:Connect(onPlayerAdded)

This code sample includes a function that will play a sound and allow it to loop for a given number of times before stopping it.

Loop a Number of Times

local function loopNTimes(sound, numberOfLoops)
if not sound.IsPlaying then
sound.Looped = true
local connection = nil
connection = sound.DidLoop:Connect(function(_soundId, numOfTimesLooped)
print(numOfTimesLooped)
if numOfTimesLooped >= numberOfLoops then
-- disconnect the connection
connection:Disconnect()
-- stop the sound
sound:Stop()
end
end)
sound:Play()
end
end
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://0"
loopNTimes(sound, 5)

PlayOnRemove

Paralel oku

Doğruysa, Sound oyundan kaldığında çalacaktır.

Not, sesin çalacağını gösterir Instance.Parent ın veya atalarından biri nul olarak ayarlandığında Sound özelliğinin veya bir atalarının nul olarak ayarlandığında tüm bunların etkisiyle sesin çalacağını gösterir. Bu, PlayOnRemove'ın doğru olduğ

soundsanat:Destron sanatını yok et.Parent = nil sonsanat.Parent = nil

Kod Örnekleri

In this sample a sound is created in the workspace, PlayOnRemove is set to true and the sound is then destroyed.

As Sound.PlayOnRemove is true, the sound will play when it is removed.

Sound PlayOnRemove

local sound = Instance.new("Sound")
sound.Name = "TestSound"
sound.SoundId = "rbxasset://sounds/uuhhh.mp3" -- oof
sound.Parent = workspace
sound.PlayOnRemove = true
task.wait(3)
sound:Destroy()

PlaybackLoudness

Salt Okunur
Çoğaltılmamış
Paralel oku

Class.Sound ın şu anda ne kadar yüksek ses çıkardığını gösteren bir sayı. 0 ile 1 arasında bir geri.

Bu özellik, sesin oynatımının bir an içinde oynatımını yansıtır. Bu nedenle, çoğu ses için bu sürekli olarak değişir. Bu nedenle, Roblox Studio özellikleri penceresinde 0 olarak görünebilir, ancak Scripts komut satırında okunan kod olarak geri dönecektir.

Kod Örnekleri

In this sample Sound.PlaybackLoudness is used to create an amplitude bar that shows the amplitude of a sound playing.

This code sample should be placed in StarterPlayerScripts.

A simple GUI is created, a frame holding that bar and a frame containing the bar. A Sound is then played and the size of the bar is set to reflect the Sound.PlaybackLoudness on a loop.

Volume Amplitude Bar

-- to be placed in StarterPlayer > StarterPlayerScripts
local Players = game:GetService("Players")
-- wait for local player PlayerGui
local LocalPlayer = Players.LocalPlayer
local playerGui = LocalPlayer:WaitForChild("PlayerGui")
-- create a ScreenGui
local screenGui = Instance.new("ScreenGui")
screenGui.Parent = playerGui
-- create a holder for our bar
local frame = Instance.new("Frame")
frame.AnchorPoint = Vector2.new(0.5, 0.5)
frame.Position = UDim2.new(0.5, 0, 0.5, 0)
frame.Size = UDim2.new(0.3, 0, 0.05, 0)
frame.Parent = screenGui
-- create a bar
local bar = Instance.new("Frame")
bar.Position = UDim2.new(0, 0, 0, 0)
bar.Size = UDim2.new(1, 0, 1, 0)
bar.BackgroundColor3 = Color3.new(0, 1, 0)
bar.Parent = frame
-- create a sound
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://9120386436"
sound.Looped = true
sound.Parent = screenGui
sound:Play()
-- define a max loudness
local maxLoudness = 30
-- animate the amplitude bar
while true do
local amplitude = math.clamp(sound.PlaybackLoudness / maxLoudness, 0, 1)
bar.Size = UDim2.new(amplitude, 0, 1, 0)
wait(0.05)
end

PlaybackRegion

Paralel oku

Bir Class.Sound.TimeLength içinde, saniye içinde istediğiniz başlangıcı (min) ve durdurma (max) süresini gösteren bir menzil.

  • PlaybackRegion.Min > 0 ise, ses PlaybackRegion.Min saatinde çalmaya başlar.

  • PlaybackRegion.Min < 0 ise, ses 0'dan başlar.

  • PlaybackRegion.Max > Sound.TimeLength ile, ses Sound.TimeLength ile durur.

  • PlaybackRegion.Max < Sound.TimeLength sağlarsa, ses o anda durur.

  • PlaybackRegion.Min == PlaybackRegion.Max ise, PlayBackRegion aktif değil.

PlaybackRegionsEnabled

Paralel oku

Eğer doğru , bu özellik, Sound 'ınızın Sound.PlaybackRegion ve 2> Class.Sound.LoopRegion2> özelliklerine erişimini sağlar, bu da onun oynatma tarzını daha doğru kontrol edebilir.

PlaybackSpeed

Çoğaltılmamış
Paralel oku

Bir Sound 'in oynayacağı hızı belirler. Değer daha yüksek olduğunda, ses daha hızlı geri çalır.

Örneğin, bir 2 değeri, Sound 'ın 2 kat daha hızlı çalmasına neden olurken, bir 0.5 değeri, Class.Sound.TimeLength (saniye olarak) için ses alır. PlaybackSpeed 1 olduğunda, ses Sound.TimeLength (saniye olarak) için tamamlanır.

Bir sesin PlaybackSpeed'ini artırmak, daha yüksek bir tonla oynatmasına neden olur.

Kod Örnekleri

In this example a Sound is played in the Workspace. The PlaybackSpeed property is increased and decreased at intervals to demonstrate its impact on the playback of the Sound.

Sound PlaybackSpeed

local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://9120386436"
sound.Looped = true
sound.Parent = workspace
sound:Play()
task.wait(10)
sound.PlaybackSpeed = 3 -- 3x faster
task.wait(5)
sound.PlaybackSpeed = 0.5 -- 2x slower
task.wait(5)
sound.PlaybackSpeed = 1 -- default

Playing

Çoğaltılmamış
Paralel oku

Class.Sound ın şu anda çalıyor olup olmadığını gösterir. Bu özellik aktifleştirilebilir ve bu özellik her zaman kopyalanır.

Stüdyo editöründe, Sounds oynatılamaz, çünkü zaman durdu. Sound.Playing'i Sounds olarak ayarlayarak sesi oynatabilirsiniz. Ancak, 1> Class.Sound|Sounds1>'i bir 4> Class.PluginGui4>

Bu özellik Sound.IsPlaying ile karıştırılmamalıdır. Okuyabilir bir özellik olduğu için oynatma başlatmak veya durdurmak için gerçekten açık veya kapalı olabilir.

Play'in false olarak ayarlandığında, sesin Sound.TimePosition özelliği yeniden ayarlanmaz. Bu, Play'in tekrar Sound:Play() sesin zaman pozisyonu devam eder. Ancak, Class.Sound:Play() işlevi kullanılırsa sesin zaman pozisyonu 0 olacaktır.

Kod Örnekleri

This sample demonstrates how the Sound.Playing property can be used to start and stop playback of a sound.

A sound is instanced in the Workspace and playback is started by setting Sound.Playing to true. After ten seconds the playback is stopped by setting Sound.Playing to false. When the playback is again resumed using Sound.Playing it resumes at the previous Sound.TimePosition it was stopped at. This is demonstrated by printing the TimePosition property immediately after resuming the sound.

Sound Playing

local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://9120386436"
sound.Looped = true
sound.Parent = workspace
print("playing sound")
sound.Playing = true
task.wait(10)
print("stopping sound")
sound.Playing = false
task.wait(5)
sound.Playing = true
local timePosition = sound.TimePosition
print("resumed at time position: " .. tostring(timePosition)) -- c. 10 seconds

RollOffMaxDistance

Paralel oku

Maksimum mesafe, inç olarak, bir klienin dinleyicisi Sound kaynağından olabilir ve hala duyabilir. Sadece şu anda bir Part ile ilgili sesleri veya Attachment (3D sesleri) duyulur.

RollOffMaxDistance'in bir sesin attenuation'ını (geçişi) etkileme şekli (düşüşü) Sound.RollOffMode özelliğine bağlıdır. RollOffMode, ters bir tip mesafe modeli (geçiş veya InverseTapered) ayarlan

RollOffMode, Linear veya LinearSquared gibi bir lineer tipi mesafeye ayarlandığında ses Sound.EmitterSize ve MaxDistance arasında azalacaktır (yeniden oynatma hacmi, MaxDistance'te yuvarlama için sıfıra ulaşana kadar yeniden oynatma hacını azaltır). Bu daha az gerçekçi, ancak bazı durumlarda daha iyi bir şekilde y

RollOffMinDistance

Paralel oku

3D bir Sound (doğrudan bir BasePart veya Attachment çocuğu) başlayacak azalmaya başlayacak (hacimde azalma).

Sesler, BasePart veya Attachment olarak adlandırılan çocuklarının 3D sesleri oynarken, sesin oynatma bağımlılığı Class.Workspace

Class.Sound ın mesafesi, dinleyiciden sesin arasındaki mesafeyi aştıktan sonra şekillenir (gitmiş olur).Class.Sound ın mesafesi, dinleyiciden sesin arasındaki mesafeyi aştıktan sonra şekillenir (gitmiş olur).

RollOffMode

Paralel oku

Bu özellik, 3D Sounds ın mesafeyi azaltmak için (gittikçe solgun) nasıl şekilleneceğini ayarlar (uyan). Onu Enum.RollOffMode 열inebilir.

Aşağıdaki kod RollOffMode'u Linear olarak ayarlayacaktır:


sound.RollOffMode = Enum.RollOffMode.Linear

Farklı modlar

Aşağıdaki seçenekler mevcut:


<tbody>
<tr>
<td>Geri</td>
<td>Ses/RolYuvarlamaMinDistance'den <code>Ses/RollOffMinDistance</code> şeklinde bir şekilde hacim azaltır.</td>
</tr>
<tr>
<td>Geriye Düzeltilmiş</td>
<td>Bir hibrid model. Yaklaşık <code>RollOffMinDistance</code> ve <code>Sound/RollOffMaxDistance</code> yakınlığında Inverse modeline uyar.</td>
</tr>
<tr>
<td>Dizgi</td>
<td>Ses <code>Sürükleme mesafesi</code> ve <code>Ses/Sürükleme mesafesi</code> arasındaki hacim, lineer bir ilişkiyle azalır.</td>
</tr>
<tr>
<td>Dikdörtgen</td>
<td>Ses <code>Sürükleme mesafesi</code> ve <code>Ses/Sürükleme mesafesi</code> arasındaki hacim, lineer bir kare ilişkisiyle azalır.</td>
</tr>
</tbody>
ModAçıklama

Geriye Dayanan vs Lineer Mesafen Azaltma

Varsayılan olarak, seslerin gerçek dünyada nasıl seslenenleri azaltacağını gösteren yanlış mesafe azaltma eğilimi (Enum.RollOffMode.Inverse) ayarlanmıştır. Yersiz mesafe azaltma eğilimi, seslerin ortak ebeveyni

RollOffMaxDistance, ters modeldeki azaltmayı etkilemez, ancak bu mesafeye ulaşıldığında sesi tamamen keser. Bu, uzun mesafe için düşük değerleri kullanırken özellikle belirgindir.

Doğrudan mesafe özelliği, sesin MaxDistance değerine bağlı olarak RollOffMinDistance ve RollOffMaxDistance arasındaki mesafeyi azaltır. Bu özellik, MaxDistance değerine bağlı olarak sesin attenuating'ini azaltır ve MaxDistance değerine ulaşıldığında sess

SoundGroup

Paralel oku

Bu SoundGroup ile bağlantılı Sound . SoundGroup.Volume ve 2>Class.SoundEffect|SoundEffects2> bu ses grubuna uygulanır. Bir ses grubunun sadece bir ses grubunda olabilir.

SoundGroups kullanılarak, birden fazla Sounds 'in ses ve etkilerini yönetmek için kullanılır. Bir Sound , ses grubunun özelliğini ayarlayarak bir 0> Class.SoundGroup0> 'e eklenir.

Kod Örnekleri

This sample demonstrates how a SoundGroup can be used to change the volume of its associated Sounds and apply SoundEffects.

In this example a Sound is instanced in the Workspace and assigned to a new SoundGroup. The Sound is played and during playback the volume is changed via the SoundGroup and a SoundEffect is added.

SoundGroups

local SoundService = game:GetService("SoundService")
-- create a sound group
local soundGroup = Instance.new("SoundGroup")
soundGroup.Parent = SoundService
-- create a sound
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://9120386436"
sound.Looped = true
sound.PlaybackSpeed = 2
sound.SoundGroup = soundGroup
sound.Parent = workspace
-- play the sound
sound:Play()
task.wait(10)
-- change the volume
soundGroup.Volume = 0.1
task.wait(3)
-- return the volume
soundGroup.Volume = 0.5
task.wait(4)
-- add a sound effect
local reverb = Instance.new("ReverbSoundEffect")
reverb.Parent = soundGroup

SoundId

ContentId
Paralel oku

Bu özellik, Sound nesnelerinin içeriğiyle ilgili bir ses dosyasının içeriğidir. Bir ses yüklenmiş olduğunda, içeriği Roblox'a yüklenmiş sesin URL'sinde bulunabilir.

URL'nin içerik ID'si ile aynı olmadığını hatırlamak önemlidir. Roblox Studio'daki bir Sound ile doğrudan yapıştırıldığında çalışacak, Studio da otomatik olarak düzeltir, ancak bir Script'den alınan numarayı kullanılmalıdır, bu da


"https://www.roblox.com/catalog/9120386436" -- Web URL (çalışmaz)
"http://www.roblox.com/asset/?id=9120386436" -- İçerik Kimliği (çalışacak)
"rbxassetid://9120386436" -- Content ID (alternative version, will work)

Kod Örnekleri

This sample gives a simple example of how a Sound that is not parented to a Part or Attachment will play at a constant volume throughout the place. A sound is instanced and parented to the Workspace, and then played.

Sound in the Workspace

local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://9120386436"
sound.Looped = true
sound.Parent = workspace
sound:Play()

TimeLength

Salt Okunur
Çoğaltılmamış
Paralel oku

Class.Sound 'in saniye içindeki uzunluğu. Sound yüklenmediyse bu değer 0 olur.

Bu özellik genellikle şu ile birleştirilir: Sound.PlaybackSpeed para birimi bir süre için kalıcı olarak kalması için sesin hızını ayarlar (örnekler). Sound.PlaybackSpeed 1 ile eşit olduğunda, sesin kalıcı olarak tamamlanması için TimeLength saniye alır.

Kod Örnekleri

This code sample includes a simple function that uses Sound.TimeLength and Sound.PlaybackSpeed to play a sound that'll take the given duration to complete. It achieves this by setting the PlaybackSpeed of the sound to be equal to the TimeLength of the sound divided by the desired duration.

Note that as TimeLength is equal to 0 when the sound has not loaded, the function will yield while it loads the sound.

Play a Sound for a Specific Duration

local function playForDuration(sound, duration)
if not sound.IsLoaded then
sound.Loaded:wait()
end
local speed = sound.TimeLength / duration
sound.PlaybackSpeed = speed
sound:Play()
end
local sound = script.Parent
playForDuration(sound, 5)

TimePosition

Çoğaltılmamış
Paralel oku

Class.Sound . Oyunun ses yönlendirme pozisyonunu gösterir. Oyun sesi çalıyorsa, ses yönlendirme kaydırıcı olarak belirlenen pozisyona otomatik olarak hareket eder. Sound . Oyun sesi çalmıyorsa, ses yönlendirici pozisyonu belirlenen pozisyonda otomatik olarak hareket eder.

Bir Sound çalındığında, TimePosition bir saniyede Sound.PlaybackSpeed artar. Bir TimePosition TimePosition ulaştığında, ses kaydedilmiş olmayan durumda Sound.TimeLength değerine ay

TimePosition değerini bir özellik olarak yuvarlak içindeki uzunluğa göre ayarlayarak etrafta sarılmayı etkilemez. Bu davranış istendiğinde geliştirici takip edilenyapmalıdır.

yeniPosition = yeniPosition - sound.TimeLength son ses.TimePosition = yeniPosition

TimePosition'ı zerondan daha az bir değere ayarlamak şu anda oynatma üzerinde etkisi yoktur, ancak bu davranış güvenilmez olmalıdır.

Kod Örnekleri

This sample demonstrates how Sound.TimePosition can be used to jump to particular points in an audio file both before and during Sound playback.

A Sound is created in the Workspace and set to start at 30 seconds in. During playback, it jumps forwards to 100 seconds and then back to the start (0 seconds).

Sound TimePosition

local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://9120386436"
sound.Parent = workspace
sound.TimePosition = 30
sound:Play()
task.wait(5)
sound.TimePosition = 100
task.wait(5)
sound.TimePosition = 0

Volume

Paralel oku

Class.Sound . Sesin oranını ayarlayabilirsiniz. Standart, 0.5'e ayarlanır

Not et that if the Sound is a member of a SoundGroup its playback volume (but not the Volume property) will be influenced by the SoundGroup.Volume property of that 1> Class.SoundGroup1> . The effect of

Kod Örnekleri

This sample includes a demonstration of how a Sound's volume can be set using the Sound.Volume property.

Sound Volume

local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://9120386436"
sound.Looped = true
sound.PlaybackSpeed = 2
sound.Parent = workspace
sound.Volume = 2
sound:Play()
task.wait(7)
sound.Volume = 0.2

Yöntemler

Pause

void

Class.Sound.Playing iletişimini Sound iletişimine ayarlar. Bu, sesin çalıyor olduğu durumda Sound:Stop() iletişimine yeniden başlatılır. 1> Class.Sound.TimePosition1> iletişimini, sesin tekrar başlatılması

Farklı ses işlevlerinin etkisi Sound.Playing ve Sound.TimePosition aşağıdaki gösterilmiştir.


<tbody>
<tr>
<td>Ses:Oynat()</td>
<td>Açık</td>
<td>Lua'da belirlenen son değer (Varsayılan 0)</td>
</tr>
<tr>
<td>Ses:bekle()</td>
<td>Kapalı</td>
<td>-</td>
</tr>
<tr>
<td>Ses: Devam Et()</td>
<td>Açık</td>
<td>-</td>
</tr>
<tr>
<td>Ses: Durdur()</td>
<td>Kapalı</td>
<td>0</td>
</tr>
</tbody>
FonksiyonSes.OynamaSes.TimePosition

Dönüşler

void

Kod Örnekleri

This sample gives a simple demonstration of what each of the Sound functions (Sound.Play, Sound.Stop, Sound.Pause and Sound.Resume) do to Sound.Playing and Sound.TimePosition.

Sound Functions

-- create a sound
local sound = Instance.new("Sound", game.Workspace)
sound.SoundId = "rbxassetid://9120386436"
if not sound.IsLoaded then
sound.Loaded:Wait()
end
-- listen for events
sound.Played:Connect(function(_soundId)
print("Sound.Played event")
end)
sound.Paused:Connect(function(_soundId)
print("Sound.Paused event")
end)
sound.Resumed:Connect(function(_soundId)
print("Sound.Resumed event")
end)
sound.Stopped:Connect(function(_soundId)
print("Sound.Stopped event")
end)
sound:Play()
print("play", sound.Playing, sound.TimePosition) -- play true 0
task.wait(10)
sound:Pause()
print("pause", sound.Playing, sound.TimePosition) -- pause false 10
task.wait(3)
sound:Resume()
print("play", sound.Playing, sound.TimePosition) -- play true 10
task.wait(3)
sound:Stop()
print("stop", sound.Playing, sound.TimePosition) -- stop false 0
task.wait(3)
sound:Play()
print("play", sound.Playing, sound.TimePosition) -- play true 0

Play

void

Oynar Sound . Set Sound.TimePosition ile son değeri ayarlar ve ardından Script (ya da 0 değilse) ile 1> Class.Sound.Playing1> ını ayarlar.

Farklı Sound işlevlerinin Sound.Playing ve Sound.TimePosition üzerindeki etkisi aşağıdaki grafikte gösterilmiştir.


<tbody>
<tr>
<td>Ses:Oynat()</td>
<td>Açık</td>
<td>Lua'da belirlenen son değer (Varsayılan 0)</td>
</tr>
<tr>
<td>Ses:bekle()</td>
<td>Kapalı</td>
<td>-</td>
</tr>
<tr>
<td>Ses: Devam Et()</td>
<td>Açık</td>
<td>-</td>
</tr>
<tr>
<td>Ses: Durdur()</td>
<td>Kapalı</td>
<td>0</td>
</tr>
</tbody>
FonksiyonSes.OynamaSes.TimePosition

Dönüşler

void

Kod Örnekleri

This sample gives a simple demonstration of what each of the Sound functions (Sound.Play, Sound.Stop, Sound.Pause and Sound.Resume) do to Sound.Playing and Sound.TimePosition.

Sound Functions

-- create a sound
local sound = Instance.new("Sound", game.Workspace)
sound.SoundId = "rbxassetid://9120386436"
if not sound.IsLoaded then
sound.Loaded:Wait()
end
-- listen for events
sound.Played:Connect(function(_soundId)
print("Sound.Played event")
end)
sound.Paused:Connect(function(_soundId)
print("Sound.Paused event")
end)
sound.Resumed:Connect(function(_soundId)
print("Sound.Resumed event")
end)
sound.Stopped:Connect(function(_soundId)
print("Sound.Stopped event")
end)
sound:Play()
print("play", sound.Playing, sound.TimePosition) -- play true 0
task.wait(10)
sound:Pause()
print("pause", sound.Playing, sound.TimePosition) -- pause false 10
task.wait(3)
sound:Resume()
print("play", sound.Playing, sound.TimePosition) -- play true 10
task.wait(3)
sound:Stop()
print("stop", sound.Playing, sound.TimePosition) -- stop false 0
task.wait(3)
sound:Play()
print("play", sound.Playing, sound.TimePosition) -- play true 0

Resume

void

Resumes the Sound . Sets Sound.Playing to true. Does not alter Sound.TimePosition and thus can be used to resume the playback of a sound stopped using 1> Class.Sound:Pause()1> .

Farklı ses işlevlerinin etkisi Sound.Playing ve Sound.TimePosition aşağıdaki gösterilmiştir.


<tbody>
<tr>
<td>Ses:Oynat()</td>
<td>Açık</td>
<td>Lua'da belirlenen son değer (Varsayılan 0)</td>
</tr>
<tr>
<td>Ses:bekle()</td>
<td>Kapalı</td>
<td>-</td>
</tr>
<tr>
<td>Ses: Devam Et()</td>
<td>Açık</td>
<td>-</td>
</tr>
<tr>
<td>Ses: Durdur()</td>
<td>Kapalı</td>
<td>0</td>
</tr>
</tbody>
FonksiyonSes.OynamaSes.TimePosition

Dönüşler

void

Kod Örnekleri

This sample gives a simple demonstration of what each of the Sound functions (Sound.Play, Sound.Stop, Sound.Pause and Sound.Resume) do to Sound.Playing and Sound.TimePosition.

Sound Functions

-- create a sound
local sound = Instance.new("Sound", game.Workspace)
sound.SoundId = "rbxassetid://9120386436"
if not sound.IsLoaded then
sound.Loaded:Wait()
end
-- listen for events
sound.Played:Connect(function(_soundId)
print("Sound.Played event")
end)
sound.Paused:Connect(function(_soundId)
print("Sound.Paused event")
end)
sound.Resumed:Connect(function(_soundId)
print("Sound.Resumed event")
end)
sound.Stopped:Connect(function(_soundId)
print("Sound.Stopped event")
end)
sound:Play()
print("play", sound.Playing, sound.TimePosition) -- play true 0
task.wait(10)
sound:Pause()
print("pause", sound.Playing, sound.TimePosition) -- pause false 10
task.wait(3)
sound:Resume()
print("play", sound.Playing, sound.TimePosition) -- play true 10
task.wait(3)
sound:Stop()
print("stop", sound.Playing, sound.TimePosition) -- stop false 0
task.wait(3)
sound:Play()
print("play", sound.Playing, sound.TimePosition) -- play true 0

Stop

void

Class.Sound durdurur. Sound.Playing değerini false olarak ayarlar ve Sound.TimePosition değerini 0 olarak ayarlar.

Farklı ses işlevlerinin etkisi Sound.Playing ve Sound.TimePosition aşağıdaki gösterilmiştir.


<tbody>
<tr>
<td>Ses:Oynat()</td>
<td>Açık</td>
<td>Lua'da belirlenen son değer (Varsayılan 0)</td>
</tr>
<tr>
<td>Ses:bekle()</td>
<td>Kapalı</td>
<td>-</td>
</tr>
<tr>
<td>Ses: Devam Et()</td>
<td>Açık</td>
<td>-</td>
</tr>
<tr>
<td>Ses: Durdur()</td>
<td>Kapalı</td>
<td>0</td>
</tr>
</tbody>
FonksiyonSes.OynamaSes.TimePosition

Dönüşler

void

Kod Örnekleri

This sample gives a simple demonstration of what each of the Sound functions (Sound.Play, Sound.Stop, Sound.Pause and Sound.Resume) do to Sound.Playing and Sound.TimePosition.

Sound Functions

-- create a sound
local sound = Instance.new("Sound", game.Workspace)
sound.SoundId = "rbxassetid://9120386436"
if not sound.IsLoaded then
sound.Loaded:Wait()
end
-- listen for events
sound.Played:Connect(function(_soundId)
print("Sound.Played event")
end)
sound.Paused:Connect(function(_soundId)
print("Sound.Paused event")
end)
sound.Resumed:Connect(function(_soundId)
print("Sound.Resumed event")
end)
sound.Stopped:Connect(function(_soundId)
print("Sound.Stopped event")
end)
sound:Play()
print("play", sound.Playing, sound.TimePosition) -- play true 0
task.wait(10)
sound:Pause()
print("pause", sound.Playing, sound.TimePosition) -- pause false 10
task.wait(3)
sound:Resume()
print("play", sound.Playing, sound.TimePosition) -- play true 10
task.wait(3)
sound:Stop()
print("stop", sound.Playing, sound.TimePosition) -- stop false 0
task.wait(3)
sound:Play()
print("play", sound.Playing, sound.TimePosition) -- play true 0

Etkinlikler

DidLoop

Class.Sound 루프ları herhangi bir zaman ateşleyen olay. Return soundId ve numOfTimesLooped, içerik ID'sini ve sesin iki katı olarak çevirim sayısını verir.

Class.Sound durdurulduğunda, çift sayıda çekirdek sayısı yeniden ayarlanır ve böylece bir sonraki DidLoop etkinliği 1'i için geri dönecektir.

Parametreler

soundId: string

Class.Sound.SoundId ile Sound arasındaki şerit.

numOfTimesLooped: number

Sound ın tekrarlandığı sayı.


Kod Örnekleri

This code sample includes a function that will play a sound and allow it to loop for a given number of times before stopping it.

Loop a Number of Times

local function loopNTimes(sound, numberOfLoops)
if not sound.IsPlaying then
sound.Looped = true
local connection = nil
connection = sound.DidLoop:Connect(function(_soundId, numOfTimesLooped)
print(numOfTimesLooped)
if numOfTimesLooped >= numberOfLoops then
-- disconnect the connection
connection:Disconnect()
-- stop the sound
sound:Stop()
end
end)
sound:Play()
end
end
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://0"
loopNTimes(sound, 5)

Ended

Oynatma tamamlandığında ateşlenir ve durur. Bu olay, Sound ın oynatma işlevini devre dışı bırakması durumunda oluşmaz.

Bu etkinlik, oynatma işlemi tamamlandığında bir sesi yok etmek için sıklıkla kullanılır.


sound:Play()
sound.Ended:Wait()
sound:Destroy()

Bu etkinlik sadece sesin bitirulaştığında başlar. Bu, sesin oynatma işleminden önce durdurulduğunda da ateşlenmeyeceği anlamına gelir, bu için Sound.Stopped der.

Parametreler

soundId: string

Sonlanan Sound.SoundId ile Sound arasındaki Class.Sound.SoundId .


Loaded

The Sound.Loaded etkinliği, Sound yüklendiğinde başlar.

Not Bu etkinlik sadece ses yüklendiğinde başlar. Bu, sesin zaten yüklendiğinde dinlenildiğinde dönmez demektir. Bu nedenle, bu etkinliğe bağlanmadan önce Sound.IsLoaded kontrol edilmesi önerilir.

Parametreler

soundId: string

Yüklendi SoundClass.Sound 'in 1>Class.Sound1> 'i.


Kod Örnekleri

This simple function will verify a Sound has loaded by checking the Sound.IsLoaded property. If Sound.IsLoaded is false it will wait for the Loaded event before resuming.

It is important to check Sound.IsLoaded before connecting to the Sound.Loaded event, as if the sound has already loaded the Sound.Loaded event will not fire and the function will yield indefinitely.

Load Sound

local sound = script.Parent.Sound
if not sound.IsLoaded then
sound.Loaded:Wait()
end
print("The sound has loaded!")

Paused

Class.Sound:Pause kullanılarak Sound:Pause() 'i durdurduğunda herhangi bir anda yanar.

Class.Sound.Played, Sound.Resumed ve Sound.Stopped ile aynı olarak, sadece 1> Class.Sound:Pause()1> , 4> Class.Sound:Pause()4> ve 7> Class.Sound.Stopped7> için etkinleştirilen ses işlevi etkinleştirilecektir. Bu, Sound.Played1>Pause</

Parametreler

soundId: string

Duraklatılmış Sound.SoundId 'in Sound ile ilgili kaydı.


Kod Örnekleri

This sample gives a simple demonstration of what each of the Sound functions (Sound.Play, Sound.Stop, Sound.Pause and Sound.Resume) do to Sound.Playing and Sound.TimePosition.

Sound Functions

-- create a sound
local sound = Instance.new("Sound", game.Workspace)
sound.SoundId = "rbxassetid://9120386436"
if not sound.IsLoaded then
sound.Loaded:Wait()
end
-- listen for events
sound.Played:Connect(function(_soundId)
print("Sound.Played event")
end)
sound.Paused:Connect(function(_soundId)
print("Sound.Paused event")
end)
sound.Resumed:Connect(function(_soundId)
print("Sound.Resumed event")
end)
sound.Stopped:Connect(function(_soundId)
print("Sound.Stopped event")
end)
sound:Play()
print("play", sound.Playing, sound.TimePosition) -- play true 0
task.wait(10)
sound:Pause()
print("pause", sound.Playing, sound.TimePosition) -- pause false 10
task.wait(3)
sound:Resume()
print("play", sound.Playing, sound.TimePosition) -- play true 10
task.wait(3)
sound:Stop()
print("stop", sound.Playing, sound.TimePosition) -- stop false 0
task.wait(3)
sound:Play()
print("play", sound.Playing, sound.TimePosition) -- play true 0

Played

Class.Sound:Play() işlevi kullanılarak Sound:Play() işlevi çalındığında herhangi bir zaman ateş eder.

As with Sound.Stopped , Sound.Paused ve Sound.Resumed sadece belirli bir ses işlevi nedeniyle olayı ateş eder. Bu, Played'in

Parametreler

soundId: string

Oynanan Sound.SoundId ın Sound kısmı.


Kod Örnekleri

This sample gives a simple demonstration of what each of the Sound functions (Sound.Play, Sound.Stop, Sound.Pause and Sound.Resume) do to Sound.Playing and Sound.TimePosition.

Sound Functions

-- create a sound
local sound = Instance.new("Sound", game.Workspace)
sound.SoundId = "rbxassetid://9120386436"
if not sound.IsLoaded then
sound.Loaded:Wait()
end
-- listen for events
sound.Played:Connect(function(_soundId)
print("Sound.Played event")
end)
sound.Paused:Connect(function(_soundId)
print("Sound.Paused event")
end)
sound.Resumed:Connect(function(_soundId)
print("Sound.Resumed event")
end)
sound.Stopped:Connect(function(_soundId)
print("Sound.Stopped event")
end)
sound:Play()
print("play", sound.Playing, sound.TimePosition) -- play true 0
task.wait(10)
sound:Pause()
print("pause", sound.Playing, sound.TimePosition) -- pause false 10
task.wait(3)
sound:Resume()
print("play", sound.Playing, sound.TimePosition) -- play true 10
task.wait(3)
sound:Stop()
print("stop", sound.Playing, sound.TimePosition) -- stop false 0
task.wait(3)
sound:Play()
print("play", sound.Playing, sound.TimePosition) -- play true 0

Resumed

Class.Sound:Resume() kullanılarak Sound:Resume() ile devam edildiğinde yanar.

Class.Sound.Played , Sound.Paused ve Sound.Stopped ile aynı ses işlevi sadece olayı ateşlemeye neden olur. Bu, 1> Class.Sound:Resume()1> çağrıldığında sadece 4> 7>Resume7> çağrıldığında4> ateşlenir.

Parametreler

soundId: string

Class.Sound.SoundId SoundClass.Sound.SoundId 1>Class.Sound1> 4>Class.Sound4> 7>Class.Sound7> 0>Class.Sound0> 3>Class.Sound3> 6>Class.Sound6> Sound.SoundId9> 2>Class.Sound2> 5>Class.Sound5> Sound.SoundId8> 1>Class.Sound1> 4>Class.Sound4> 7>Class.Sound7>


Kod Örnekleri

This sample gives a simple demonstration of what each of the Sound functions (Sound.Play, Sound.Stop, Sound.Pause and Sound.Resume) do to Sound.Playing and Sound.TimePosition.

Sound Functions

-- create a sound
local sound = Instance.new("Sound", game.Workspace)
sound.SoundId = "rbxassetid://9120386436"
if not sound.IsLoaded then
sound.Loaded:Wait()
end
-- listen for events
sound.Played:Connect(function(_soundId)
print("Sound.Played event")
end)
sound.Paused:Connect(function(_soundId)
print("Sound.Paused event")
end)
sound.Resumed:Connect(function(_soundId)
print("Sound.Resumed event")
end)
sound.Stopped:Connect(function(_soundId)
print("Sound.Stopped event")
end)
sound:Play()
print("play", sound.Playing, sound.TimePosition) -- play true 0
task.wait(10)
sound:Pause()
print("pause", sound.Playing, sound.TimePosition) -- pause false 10
task.wait(3)
sound:Resume()
print("play", sound.Playing, sound.TimePosition) -- play true 10
task.wait(3)
sound:Stop()
print("stop", sound.Playing, sound.TimePosition) -- stop false 0
task.wait(3)
sound:Play()
print("play", sound.Playing, sound.TimePosition) -- play true 0

Stopped

Class.Sound:Stop işlevi nedeniyle Sound:Stop() işlevi durdurulduğunda yanar.

Class.Sound.Played, Sound.Paused ve Sound.Resumed ile aynı ses işlevi sadece olayı ateşlemeye yetecektir. Bu, durduğunda sadece 1>Class.Sound:Stop1> çağrılırsa olayı ateşlemeye sadece Stop eder. bir sesi durdururken

Parametreler

soundId: string

Duran Sound.SoundId 'in Sound 'ı.


Kod Örnekleri

This sample gives a simple demonstration of what each of the Sound functions (Sound.Play, Sound.Stop, Sound.Pause and Sound.Resume) do to Sound.Playing and Sound.TimePosition.

Sound Functions

-- create a sound
local sound = Instance.new("Sound", game.Workspace)
sound.SoundId = "rbxassetid://9120386436"
if not sound.IsLoaded then
sound.Loaded:Wait()
end
-- listen for events
sound.Played:Connect(function(_soundId)
print("Sound.Played event")
end)
sound.Paused:Connect(function(_soundId)
print("Sound.Paused event")
end)
sound.Resumed:Connect(function(_soundId)
print("Sound.Resumed event")
end)
sound.Stopped:Connect(function(_soundId)
print("Sound.Stopped event")
end)
sound:Play()
print("play", sound.Playing, sound.TimePosition) -- play true 0
task.wait(10)
sound:Pause()
print("pause", sound.Playing, sound.TimePosition) -- pause false 10
task.wait(3)
sound:Resume()
print("play", sound.Playing, sound.TimePosition) -- play true 10
task.wait(3)
sound:Stop()
print("stop", sound.Playing, sound.TimePosition) -- stop false 0
task.wait(3)
sound:Play()
print("play", sound.Playing, sound.TimePosition) -- play true 0