How to add sound once u press esc (on da menu)

Hello, so I took this free model script (for fun and credit to the person that made it)… but I modified it.

I’m having trouble adding a sound effect once you press esc… how do you do it because the sound isn’t showing up and I can’t hear it. Here’s the script:

local GuiService = game:GetService('GuiService')

local TweenService = game:GetService('TweenService')

local camera = workspace.CurrentCamera or workspace:GetPropertyChangedSignal('CurrentCamera'):Wait()
local sound = game:GetService("SoundService")
--
local tweenInfo = TweenInfo.new(0.5)

local blur = Instance.new('BlurEffect')
blur.Size = 0
blur.Parent = camera

local tween = TweenService:Create(blur, tweenInfo, {Size = 0})

GuiService.MenuOpened:Connect(function()
	tween:Cancel()
	blur.Size = 24
	sound.Volume = 9
	sound.Looped = true
	sound.SoundID = "rbxassetid://16823258948"
	sound:Play()
end)

GuiService.MenuClosed:Connect(function()
	tween:Play() 
end)

– I don’t even know what I’m doing lol but yea, some help would be nice and also, I seen people do it I just forgot how to make it properly. So please, somebody help once for all!

2 Likes

This needs to be in #help-and-feedback:scripting-support

The sound variable needs to be a sound object not sound service. Make a sound in sound service and change the variable to reference it

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.