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?
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.