🔊How to ADD music into DIFFRENT AREAS 🔊 | Roblox studio

Channel:
Subscribers:
3,680
Published on ● Video Link: https://www.youtube.com/watch?v=2FbFEDOsJnk



Roblox
Game:
Roblox (2006)
Category:
Tutorial
Duration: 4:41
634 views
30


Thanks for watching! This video is a Roblox Studio Tutorial

Script:

local AreaSounds = Instance.new("Sound", script) - - "Sound" Here put your sound name
AreaSounds.Looped = true
local plr = script.Parent
local Presser = plr:WaitForChild("HumanoidRootPart")
local DifferentAreas = workspace:WaitForChild(" ") - - - - Put here you model name
local CurrentArea = nil

game:GetService("RunService").Heartbeat:Connect(function()
local raycast = Ray.new(Presser.Position, Presser.CFrame.UpVector * -1000)
local part = workspace:FindPartOnRayWithWhitelist(raycast, {DifferentAreas})
if part and part.Parent == DifferentAreas then
if part ~= CurrentArea then
CurrentArea = part
AreaSounds.SoundId = CurrentArea.Sound.SoundId
AreaSounds:Play()
end
else
CurrentArea = nil
AreaSounds:Stop()
end
end)


Twitch: https://www.twitch.tv/the_lovjak
Twitter 🐦: https://twitter.com/ThE_LovJak
Discord: https://discord.gg/bcCFBdZ8dm

Subscribe to JakLov: https://www.youtube.com/channel/UCZYHTvHRCqAvNAaiBJZw0Rg







Tags:
Roblox
Roblox studio
studio
music
sound
touch
tutoria
tutorial



Other Statistics

Roblox Statistics For LovJak

Currently, LovJak has 127,722 views for Roblox across 80 videos. His channel uploaded 9 hours worth of Roblox videos, or 26.34% of the total watchable video on LovJak's YouTube channel.