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

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

Asked by 8 years ago

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?

0
I have also tried wait(20) and removed the 1st line and still didnt work. AverageHackerman 0 — 8y
1
Do you want all of the players to hear this sound or just the player who joined? User#5423 17 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

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.

Ad

Answer this question