Universal Script 📌
1.1k Views
2.1k Executions

Music id script

Universal Script 📌
Kyelisz
KyeliszPublished 10
7 months ago
Get an executor
Please login to perform these actions:

Does it work?

No reports yet

No reports yet. Tried it? Be the first to say.

Also noticed:

Description

a script that plays any sound of your will THIS IS VISUALS ONLY YOU CAN HEAR THIS

View Raw
-- 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()


Comments

0
Log in to join the conversation. Login
No comments yet. Be the first!

Tags

More universal scripts

See all
Universal Script 📌
5.6k
17.3k
Bumped 3 minutes ago
Universal Script 📌
69
6
Approved 2 hours ago
Universal Script 📌
333.4k
40.1k
Bumped 2 hours ago
Universal Script 📌
2.6k
13.1k
Bumped 2 hours ago
Key System