#forsaken chase theme system cheap version

1 messages · Page 1 of 1 (latest)

fierce vector
#

help i make a script and put it inside a humanoidrootpart but it doesnt work💔💔💔
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")

local e = script.Parent
local a = script.Layers

local function getDistanceFromPlayer(player)
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if humanoidRootPart then
return (humanoidRootPart.Position - e.Position).Magnitude
end
return math.huge
end

local function playLayer(layerName)
for _, sound in a:GetChildren() do
if sound:IsA("Sound") then
local targetVolume = sound.Name == layerName and 1 or 0
TweenService:Create(sound, TweenInfo.new(0.5), {Volume = targetVolume}):Play()
end
end
end

local function updateMusicLayer()
for _, player in Players:GetPlayers() do
local distance = getDistanceFromPlayer(player)
if distance >= 45 and distance < 60 then
playLayer("L1")
elseif distance >= 30 and distance < 45 then
playLayer("L2")
elseif distance >= 15 and distance < 30 then
playLayer("L3")
elseif distance < 15 then
playLayer("L4")
end
end
end

RunService.Heartbeat:Connect(updateMusicLayer)

#

forsaken chase theme system cheap version

willow saddle
#

if layers meant to be player

#

pr

mint hollow