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

Audio Sound Play Script Problem? *Need Some Helps*

Asked by
ImfaoXD 158
7 years ago
Edited 7 years ago

Can somebody help me? For some reason, my audio sound script work perfectly when I tested it in the studio and not in the actual game. How come? The brick make sound when someone step or touch the "Part" and the sound will play. I tried to added in the "Time Length" which is on line 7 and it work just fine in the studio but when I tested it in the actual game the script doesn't work.

You can also check my layout script if you are confuse:

https://gyazo.com/ceeaeb00fda00022dc87fe1236b66e24

local ready = true -- defines "ready"

script.Parent.Touched:connect(function() 
if ready == true then 
ready = false 
script.Parent.Sound:Play()
wait(script.Parent.Sound.TimeLength) -- the part you wanted
print("finished playing")
wait(3) 
print("3 seconds have passed")
ready = true 
end
end)
0
Where is the part the sound is in located? voximity 75 — 7y
0
I put the script which is above in a regular script in the part along with the soundtrack. Check the link above, I made an image of my layout. ImfaoXD 158 — 7y

1 answer

Log in to vote
0
Answered by
Valatos 166
7 years ago
Edited 7 years ago

The TimeLenght is for visual only, this means scripts Can't edit or use it
Not really very sure about it

local ready = false

script.Parent.Touched:connect(function()
    if ready == true then
        ready = false
        script.Parent.Sound:Play()
        script.Parent.Sound.Ended:connect(function() -- The part where we get the information the sound ended
            print("Finished playing")
            wait(3)
            print("3 seconds passed")
            ready = true
        end)
    end
end)

Hope this works for you as i haven't tested this

Ad

Answer this question