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

How to change sound settings in GUI button script? (Not a Local Script)

Basically, I have this script, when you click on the TextButton it plays sound. The sound works - its placed in Workspace and the script is in a ScreenGui in the TextButton located in StarterGui

This is how the script works

script.Parent.MouseButton1Click:Connect(function()
	game.Workspace.Sound1:Play()
end)

What I want to know is how to change things like MaxDistance and Volume for the sound. I have tried editing the sound properties itself, but it changes nothing in-game.

Example - I put Maxdistance as low as 0.5 and Volume at 0.1 in the sound properties, but it was still playing when my friend was very far away from me.

Hope I made it clear enough to understand. Just an FYI, im basically a starter with scripting, with little knowledge. Any and all help is appreciated

2 comments

0

Probably game isn't published and left the sound's properties unchanged, change it again and publish it. Also make sure there are no other scripts ruining it, or another sound with same name.

0

"(Not a Local Script)" that means you're using a server script, right? The thing is, server scripts don't run in the StarterGui/PlayerGui.

1 answer

When a sound is in the Workspace, there is no set distance from where you can hear the sound. When a sound is in a body that has a positional vector (like a BasePart), the sound will be playing from that part, and the farther away you get from it the fainter the sound will get.

MaxDistance is entirely irrelevant if the sound is in either SoundService or Workspace. In order for it to work the sound needs to be inside of something that has a 3D position.

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