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

The audio that should run from my script isn't running, what should I do to fix it?

I am trying to make a script that when a player joins it plays an audio for 20 seconds and stops. I have a sound object named "sound" with the id of the audio I want to play. Here is my script.

local timelength = 20

game.Players.PlayerAdded:connect(function(player)
	sound:Play()
	wait(timelength)
	sound:Stop()
end)

Why isnt the script working and how can I fix it?

2 comments

0

I have also tried wait(20) and removed the 1st line and still didnt work.

1

Do you want all of the players to hear this sound or just the player who joined?

1 answer

Do you have a variable assigned for "sound"? If you're just saying "sound" it has no idea what 'sound" is. Such as...

sound = game.Workspace.sound

Not exactly like that but you get the point.

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