I'm not sure if you can do this but can you have a music player which plays a specific music id within an area of a brick only. I know that you can do this with sound environments that have a script preset with the id but I'm not sure if there's a way to play a id within a game. This is not a request I just wanna know if its possible, im fairly new to scripting. I have all the scripts to play the actual id I'm just not sure if or how I can contain it within a brick.
local SG = game:GetService("StarterGui")
local P = game:GetService("Players")
local B = game.Workspace:WaitForChild("Radio") or game.Workspace:FindFirstChild("Radio")
local Debounce = false
P.PlayerAdded:connect(function(player)
if player ~= nil and Debounce == false then
Debounce = true
if B and Debounce == true then
if B.Brain.MainWall:FindFirstChild("RadioSurfaceGui") then --
local Gui = B.Brain.MainWall:FindFirstChild("RadioSurfaceGui")
if Gui then
Gui.Parent = SG
if SG:FindFirstChild("RadioJSurfaceGui") then
local RealGui = SG:FindFirstChild("RadioSurfaceGui")
if RealGui then
RealGui.Adornee = B.Brain.MainWall
wait()
Debounce = false
end
end
end
else
if not B.Brain.MainWall:FindFirstChild("DRadioSurfaceGui") then
warn("Don't move the SurfaceGui into StarterGui!")
end
end
end
end
end)
Script to playthe music
local TB = script.Parent.Parent.TopBox
local BP = game.Workspace.Radio
local Pattern = "^%d+$"
script.Parent.MouseButton1Click:connect(function()
if TB.Text:match(Pattern) then
BP.Sound.SoundId = "http://www.roblox.com/asset/?id=" .. TB.Text
BP.Sound:Play()
wait(1)
TB.ClearTextOnFocus = true
TB.Text = "Click here, type an Audio ID, then click Enter"
TB.LocalScript.Disabled = true
wait()
TB.LocalScript.Disabled = false
else
if not TB.Text:match(Pattern) then
TB.ClearTextOnFocus = true
TB.Text = "Invalid Audio ID"
wait(1.5)
TB.Text = "Click here, type an Audio ID, then click Enter"
end
end
end)
Script to stop the music
local TB = script.Parent.Parent.TopBox
local BP = game.Workspace.Radio
script.Parent.MouseButton1Click:connect(function()
BP.Sound:Stop()
BP.Sound1:Stop()
end)

3 comments
use EmitterSize, but you can't position a Sound instance
sorry
technically you can position a sound instance, just put it in a part and move the part to the correct position, then just make the part invisible and cancollide false.