Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Audio Sound Play Script Problem? *Need Some Helps*

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)

2 comments

0

Where is the part the sound is in located?

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.

1 answer

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.