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

Sound doesn't loop?

Asked by
yoshiegg6 176
9 years ago

I have a brick with fire on it, and inside the brick is a sound with the sound ID preset and the looped set as true. In my script I have this line (outside a function, it should just continue playing when its in the workspace).

S = script.Parent.Sound
S:Play()

It plays once and then stops even though it's set as looped. What do I do?

Edit: This is playing in a brick and it's supposed to play until it's removed, not when someone joins. Also, it should be loud enough that most people can hear it not just someone close to it.

3 answers

Log in to vote
0
Answered by 9 years ago

Here you go bud: If you want it to run globally as in you can hear it from anywhere, place it inside of workspace with a sound inside of workspace.

If you want it locally, put the sound inside of the brick and the script inside of the brick, this will then make the sound locally and only be heard near that brick.

function onPlayerAdded() 
wait(0.1) 
script.Parent.Sound:Play() 
script.Parent.Sound.Looped = true
end

game.Players.PlayerAdded() 
Ad
Log in to vote
0
Answered by
woodengop 1134 Moderation Voter
9 years ago

Try doing it this way:

s = script.Parent

while wait(9) do -- change the Time length
s.sound:play()
end

if that doesn't work out try doing this

s = script.Parent
s.sound:play()
s.sound.Looped = true
Log in to vote
-1
Answered by 9 years ago

Try this.

function onPlayerAdded()
    wait(0.1)
    while true do
    script.Parent.Sound.Play()
    wait(120)-- length of the song time
game.Players.PlayerAdded()

So the sound will play when a player is added/respawned. And put the script and the sound in WORKSPACE. Not in a part.

If you want the brick to play sound, you would need a local script, with a code that when a player gets close to the brick, it will play a sound. If you want that, just put a invisible brick next to the brick you want to play a sound, and use an onTouch function when a player touches it, a sound will play.

0
This is playing in a brick and it's supposed to play until it's removed, not when someone joins. Also, it should be loud enough that most people can hear it not just someone close to it. yoshiegg6 176 — 9y

Answer this question