--print(ChosenNTID)

NightTheme.SoundId = "rbxassetid://" .. ChosenNTID
NightTheme.Ended:Connect(function()
UpdateNightThemeID()
end)
end

NightTheme:Play()
UpdateNightThemeID()

game:GetService("RunService").RenderStepped:Connect(function()
if Rake ~= nil and Rake:FindFirstChild("HumanoidRootPart") ~= nil then
if CharacterRoot ~= nil and ChracterHumanoid ~= nil then -- Check if The rake, Player character, Player character humanoid still exist
RangeMagnitude = (Rake.HumanoidRootPart.Position - CharacterRoot.Position).magnitude
if Rake.Stunning.Value == true then
StunDebounce = true
if RangeMagnitude < 70 then
ReplayDebounce = true
end
StopSound()
elseif Rake.Stunning.Value == false or ChracterHumanoid.Health > 0 then
StunDebounce = false
if ReplayDebounce == true and RangeMagnitude < 70 then
ReplayDebounce = false
StartSound()
end
end
if RangeMagnitude < 70 and Debounce1 == false and StunDebounce == false then
Debounce1 = true
StartSound()
elseif RangeMagnitude > 70 and StunDebounce == false and Debounce1 == true then
Debounce1 = false
ReplayDebounce = false
StopSound()
end
if RangeMagnitude < 90 and RangeMagnitude > 70 and StunDebounce == false and not Debounce2 then
Debounce2 = true			
StopSound()
NearTheme:Play()	
elseif Debounce2 and Debounce1 or StunDebounce or RangeMagnitude > 90 then
NearTheme:Stop()	
Debounce2 = false	
end
if RakeTheme.IsPlaying then
if RangeMagnitude > 70 then
Debounce1 = false
ReplayDebounce = false
StopSound()
end
if Rake.NPC.Health <= 0 then
script.Parent:Destroy()
end
if ChracterHumanoid.Health <= 0 then
StopSound()
end
if RangeMagnitude < 70 and RangeMagnitude > 35 then
RakeTheme.PlaybackSpeed = 0.95
end
if RangeMagnitude < 35 and RangeMagnitude > 20 then
RakeTheme.PlaybackSpeed = 1
end
if RangeMagnitude < 20 then
RakeTheme.PlaybackSpeed = 1.05
end
end
end
end
end)