Hey guys, I’d like some help making an area only playlist. For some reason the music never changes and is very buggy.
local YourPlayer = game.Players.LocalPlayer
local Character = YourPlayer.Character or YourPlayer.CharacterAdded:Wait()
local Torso = Character:WaitForChild("HumanoidRootPart")
local RegionPart = game.Workspace:WaitForChild("Area1")
local MinSize = RegionPart.Position - (RegionPart.Size * 0.5)
local MaxSize = RegionPart.Position + (RegionPart.Size * 0.5)
local Region = Region3.new(MinSize, MaxSize)
local RunService = game:GetService("RunService")
local Sound1 = game.Workspace.LobbyPlaylist.Lobbysound --Insert your sound object here
local Sound2 = game.Workspace.LobbyPlaylist.Lobbysound2 --Insert your sound object here
RunService.RenderStepped:Connect(function()
local Parts = workspace:FindPartsInRegion3(Region, RegionPart, math.huge)
local PlayerSearch = table.find(Parts, Torso)
if PlayerSearch then
Sound1.Volume = 0.5
Sound2.Volume = 0
wait(20) -- duration of song
Sound1.Volume = 0
Sound2.Volume = 0.5
wait(10) -- duration of song
else
Sound1.Volume = 0
end
end)
-- I am assuming both of the songs are not playing and that both are at a volume higher then 0 when the script gets to this comment
Sound1:Play()
Sound1.Ended:Wait()
Sound2:Play()
Sound2.Ended:Wait()
local YourPlayer = game.Players.LocalPlayer
local Character = YourPlayer.Character or YourPlayer.CharacterAdded:Wait()
local Torso = Character:WaitForChild("HumanoidRootPart")
local RegionPart = game.Workspace:WaitForChild("Area1")
local MinSize = RegionPart.Position - (RegionPart.Size * 0.5)
local MaxSize = RegionPart.Position + (RegionPart.Size * 0.5)
local Region = Region3.new(MinSize, MaxSize)
local RunService = game:GetService("RunService")
local Sound1 = game.Workspace.LobbyPlaylist.Lobbysound --Insert your sound object here
local Sound2 = game.Workspace.LobbyPlaylist.Lobbysound2 --Insert your sound object here
RunService.RenderStepped:Connect(function()
local Parts = workspace:FindPartsInRegion3(Region, RegionPart, math.huge)
local PlayerSearch = table.find(Parts, Torso)
if PlayerSearch then
Sound1.Volume = 0.5
Sound1:Play()
wait(20) -- duration of song
Sound1.Ended:Wait()
Sound2.Volume = 0.5
Sound2:Play()
wait(10) -- duration of song
Sound2.Ended:Wait()
else
Sound1.Volume = 0
end
end)
local YourPlayer = game.Players.LocalPlayer
local Character = YourPlayer.Character or YourPlayer.CharacterAdded:Wait()
local Torso = Character:WaitForChild("HumanoidRootPart")
local RegionPart = game.Workspace:WaitForChild("Area1")
local MinSize = RegionPart.Position - (RegionPart.Size * 0.5)
local MaxSize = RegionPart.Position + (RegionPart.Size * 0.5)
local Region = Region3.new(MinSize, MaxSize)
local RunService = game:GetService("RunService")
local Sound1 = game.Workspace.LobbyPlaylist.Lobbysound --Insert your sound object here
local Sound2 = game.Workspace.LobbyPlaylist.Lobbysound2 --Insert your sound object here
RunService.RenderStepped:Connect(function()
local Parts = workspace:FindPartsInRegion3(Region, RegionPart, math.huge)
local PlayerSearch = table.find(Parts, Torso)
if PlayerSearch then
Sound1:Play()
Sound1.Ended:Wait()
Sound2:Play()
Sound2.Ended:Wait()
else
Sound1.Volume = 0
end
end)
Didn’t change the songs for some reason. I also want the songs to turn off when you exit that area.
local YourPlayer = game.Players.LocalPlayer
local Character = YourPlayer.Character or YourPlayer.CharacterAdded:Wait()
local Torso = Character:WaitForChild("HumanoidRootPart")
local RegionPart = game.Workspace:WaitForChild("Area1")
local MinSize = RegionPart.Position - (RegionPart.Size * 0.5)
local MaxSize = RegionPart.Position + (RegionPart.Size * 0.5)
local Region = Region3.new(MinSize, MaxSize)
local RunService = game:GetService("RunService")
local Sound1 = game.Workspace.Lobbysound --Insert your sound object here
local Sound2 = game.Workspace.Lobbysound2 --Insert your sound object here
RunService.RenderStepped:Connect(function()
local Parts = workspace:FindPartsInRegion3(Region, RegionPart, math.huge)
local PlayerSearch = table.find(Parts, Torso)
if PlayerSearch then
Sound2:Play()
Sound2.Ended:Wait()
Sound2:Stop()
Sound1:Play()
Sound1.Ended:Wait()
Sound1:Stop()
else
Sound1:Stop()
Sound2:Stop()
end
end)
After some more experimentation I find that it still doesn’t work. No errors. What should I do?