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

How to add sound into cloned object, adjust volume then play it?

I been trying to add a sound into a cloned object and then play it. Though I've not sure what I've been doing wrong since there's no error in Dev Console or Output.

local sword=game.ReplicatedStorage.sword1v:Clone()
local sound = Instance.new("Sound")
local soundid = "3031372793"
local sp = sword.sound
sp.SoundId = soundid
sp.Volume = 3
sp:Play()
  1. After adding rbxassetid://, I now received an error on my output.

sound is not a valid member of MeshPart "sword1v"

1 answer

✓ Accepted answer

You forgot to add "rbxassetid://" to the start of soundid

local sword=game.ReplicatedStorage.sword1v:Clone()
sword.Parent = workspace -- set this to whatever it was intentionally supposed to be
local sound = Instance.new("Sound")
sound.Parent = sword
local soundid = "rbxassetid://3031372793" -- If you want to play a sound from the roblox website put "rbxassetid://" before the id.
sound.SoundId = soundid
sound.Volume = 3
sound:Play()

4 comments

0

I will remember that, but now I have another error saying: sound is not a valid member of MeshPart "sword1v". any idea?

0

You forgot to parent sound.

0

Also you can just use sound instead of sp

0

I see, thank you

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