
KeylessUniversal

-- Configuration
local SOUND_ID = "rbxassetid://17594884733" -- Replace with your actual sound ID i just put a knocking sound for now
local PLAY_DURATION = 6.999999999999 -- seconds
-- Create or get the Sound object
local sound = Instance.new("Sound")
sound.SoundId = SOUND_ID
sound.Volume = 1 -- Adjust volume (0 to 10)
sound.Looped = false
sound.Parent = game.Workspace -- You can parent it to a part or UI element
-- Function to play and stop the sound
local function playAndStopSound()
-- Safety check
if not sound.SoundId or sound.SoundId == "" then
warn("No valid SoundId set.")
return
end
-- Play the sound
sound:Play()
-- Wait for the specified duration
task.wait(PLAY_DURATION)
-- Stop the sound
if sound.IsPlaying then
sound:Stop()
print("Sound stopped after " .. PLAY_DURATION .. " seconds.")
end
end
-- Run the function
playAndStopSound()No comments yet for this script.



