local MusicSystem = script.Parent.Play
local Humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
local Char = game.Players.LocalPlayer.Character
local Combat = false
local Reset = false
-------------------------------------------------------------------------------
--Combat/Idle Mode--
-------------------------------------------------------------------------------
game:GetService('RunService').RenderStepped:Connect(function()
for i, v in pairs(game.Players:GetChildren()) do	
 if v.Name ~= Char.Name and Combat == false and (Char.HumanoidRootPart.Position - v.Character:FindFirstChild("HumanoidRootPart").Position).magnitude <= (150) then		
  local Target = v.Name
  Combat = true
  MusicSystem.Audio:Remove()	
  local Combat = MusicSystem.Mode.Combat.Audio:Clone()
  Combat.Parent = MusicSystem
  MusicSystem.Disabled = true
  MusicSystem.Disabled = false
  script.Parent.States.Visible = true
 elseif v.Name ~= Char.Name and Combat == true and (Char.HumanoidRootPart.Position - v.Character:FindFirstChild("HumanoidRootPart").Position).magnitude >= (150) then
  Combat = false
  MusicSystem.Audio:Remove()	
  local Idle = MusicSystem.Mode.Idle.Audio:Clone()
  Idle.Parent = MusicSystem
  MusicSystem.SelectedSong.PlaybackSpeed = 1
  MusicSystem.Disabled = true
  MusicSystem.Disabled = false
  script.Parent.States.Visible = false
  end
 end
end)

1 comment

0

This script is messy, lol.