#Sounds script
20 messages · Page 1 of 1 (latest)
-- Place this script inside a part (part1) that you want to monitor for collisions
local part2 = workspace.Part2 -- Reference to the other part
local soundId = "rbxassetid://123456789" -- Replace this with the ID of the sound you want to play
local soundVolume = 1 -- Adjust the volume of the sound (0 to 1)
local function onCollision(otherPart)
if otherPart == part2 then
local sound = Instance.new("Sound")
sound.SoundId = soundId
sound.Volume = soundVolume
sound.Parent = game.Workspace -- Play the sound in the Workspace so it's audible
sound:Play()
sound.Ended:Connect(function()
sound:Destroy() -- Remove the sound object after it finishes playing
end)
end
end
script.Parent.Touched:Connect(onCollision)
You have to replace the robloxassetid123456789 with the actual id of the sound you want to play
And if part 2 is not named part 2 in your game replace it by their name
but
i need help with one
The Part2 is in one model
@coral aspen
This part2 is in the SU12E3 -> Original -> SU12SILNIK -> F (In the folder "F" is part2)
-- Place this script inside a part (part1) that you want to monitor for collisions
local part2 = workspace.Original.SU12SILINK.F -- Reference to the other part
local soundId = "rbxassetid://123456789" -- Replace this with the ID of the sound you want to play
local soundVolume = 1 -- Adjust the volume of the sound (0 to 1)
local function onCollision(otherPart)
if otherPart == part2 then
local sound = Instance.new("Sound")
sound.SoundId = soundId
sound.Volume = soundVolume
sound.Parent = game.Workspace -- Play the sound in the Workspace so it's audible
sound:Play()
sound.Ended:Connect(function()
sound:Destroy() -- Remove the sound object after it finishes playing
end)
end
end
script.Parent.Touched:Connect(onCollision)```
I try
not works...
It's not works
** You are now Level 3! **
Can anyone write me that script because i don't know the scripts ðŸ˜: When part1 touch part2, part1 playing a sound.
not works
my apologies.
-- Place this script inside a part (part1) that you want to monitor for collisions
local part2 = workspace.Original.SU12SILINK.F.part2 —change part2 to a specific name
local soundId = "rbxassetid://123456789" -- Replace this with the ID of the sound you want to play
local soundVolume = 1 -- Adjust the volume of the sound (0 to 1)
local function onCollision(otherPart)
if otherPart == part2 then
local sound = Instance.new("Sound")
sound.SoundId = soundId
sound.Volume = soundVolume
sound.Parent = game.Workspace -- Play the sound in the Workspace so it's audible
sound:Play()
sound.Ended:Connect(function()
sound:Destroy() -- Remove the sound object after it finishes playing
end)
end
end
script.Parent.Touched:Connect(onCollision)```
But