So i am working on a game with my friend where each area plays different music like the very 1st version of his game, and i don't know how but the sound regions are not playing the music we tried different scripts but i never worked so if i could have some help that would be nice! Its a local script and it still isn't working BTW
local SoundRegionsWorkspace = game.Workspace:WaitForChild("SoundRegions")
local Found = true
while wait(1)do
for i, v in pairs(SoundRegionsWorkspace:GetChildren())do
Found = false
local region = Region3.new(v.Position - (v.Size/2),v.Position + (v.Size/2))
local parts = game.Workspace:FindPartsInRegion3WithWhiteList(region, game.Players.LocalPlayer.Character:GetDescendants())
for _, part in pairs(parts)do
-- Loop thingie
if part:FindFirstAncestor(game.Players.LocalPlayer.Name) then
print('Player was found')
Found = true
break
else
Found = false
print('Player was not found in region')
end
end
if Found == true then
-- Start playing music
if script.Parent.SoundRegions[v.Name].IsPlaying == false then
script.Parent.SoundRegions[v.Name]:Play()
break
end
else
script.Parent.SoundRegions[v.Name]:Stop()
end
end
end

2 comments
its uhh not on sale
damnit my bad lol should be working now sorry for the wait