hello, it’s mari here, I have been very struggling with making mute button for sound regions since months ago, and I want to end the trouble and help many peoples by releasing sound region with mute button model. I’ll say the what I should say here below.
-
I want to make “GUI button” that changes the “playing value” of the sound object that gets implemented inside every model of players in “workspace” upon clicking the GUI button,, I was kinda able to make GUI button changes it’s text by “Mute musics”(when musics isn’t muted) and “Unmute musics”(when musics are muted by GUI button)
-
I do not know how to edit the script so it changes the “playing value” of sound object that is inside “local startercharacter script” that gets implemented in every player models. and it would be awesome to get helped so I can make free sound region with mute button asset in roblox model marketplace for everyone ;>}
-
I tried to change the scripts with multiple ideas and changes, but never got luck at this.
also I might go show you guys about two codes I used for mute button and sound region script,
(mute button by robloxian on yt)
local mutebutton = script.Parent
local music = game.Players.LocalPlayer.Character:GetChildren("Sound")
playing = true
mutebutton.MouseButton1Click:Connect(function()
if playing == true then
music.Playing = false
mutebutton.Text = "Unmute Musics"
playing = false
else
music.Playing = true
mutebutton.Text = "Mute Musics"
playing = true
end
end)
(sound region script by howtoroblox)
local sound = Instance.new("Sound", script)
sound.Looped = true
local char = script.Parent
local hrp = char:WaitForChild("HumanoidRootPart")
local areasGroup = workspace:WaitForChild("Areas")
local currentArea = nil
game:GetService("RunService").Heartbeat:Connect(function()
local raycast = Ray.new(hrp.Position, hrp.CFrame.UpVector * -1000)
local part = workspace:FindPartOnRayWithWhitelist(raycast, {areasGroup})
if part and part.Parent == areasGroup then
if part ~= currentArea then
currentArea = part
sound.SoundId = currentArea.Music.SoundId
sound:Play()
end
else
currentArea = nil
sound:Stop()
end
end)
also I used some roblox studio tutorials on youtube for see how to make mute button and sound regions, but there was no video about how peoples can make mute button that mutes sound region musics despite some popular games like “bee swarm simulator” and “find the markers” have that functions.
howtoroblox’s guide of how to make sound regions which I used:
howtoroblox’s sound region video
robloxian’s guide of how to make mute buttons which I used and edited a bit:
robloxian’s mute button video
also the video of mute button functions in my game, I did something bit right but I’m not there yet.
need more informations for help me out? then please comment below to speak out, mari thank you.