Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- character = owner.Character
- script.Parent = character
- root = character.HumanoidRootPart
- local tweenService = game:GetService("TweenService")
- local marketPlaceService = game:GetService("MarketplaceService")
- local fakePosition = Instance.new("CFrameValue")fakePosition.Value = CFrame.new(0,0,0)
- local mainPosition = Vector3.new(0,0,0)
- local localscript
- local model
- local lastpart = nil
- local soundId = 15993696418
- local songPitch = 0.5
- local totalparts = {}
- local nearestParts = {}
- local defaultSaturation = 0.5
- local defaultHue = 1
- local number = 0
- local sine = 0
- local spin = 0
- local loudness = 0
- local size = 1
- local maxnumber = 50
- local clientVisuals = false
- --songs--
- --wake up = 16831105725
- --messed up = 16831107576
- --winterstep = 1841529500
- --the storm = 5410084538 pitch = 1
- --inital D = 16831106636 pitch = 1
- --THE ONEPIECE IS REAL = 1838028562 pitch = 1
- --Save & Sound = 7024233823 pitch = 1
- --Instanity = 15986456953 = pitch = 1
- --Rockfeller street rock = 16831104459 pitch = 0.85
- --Ohio rock = 13530438676 pitch = 1
- --Sword theme = 12578363577 pitch = 1
- --Camellia NUCLEARSTAR = 14526166053 pitch = 1
- --OneRepublic - Counting Stars = 14530875495 pitch = 0.6047
- --Action Winter Journey - Nero's Day At Disneyland = 15986402753 pitch = 1
- --Devil trigger = 16610413169 pitch = 1
- --Numb the pain = 17109283990 pitch = 0.7
- --Smells like teen spirit = 17780367727 pitch = 1.6667
- --Good rock dubstep = 17901048715 pitch = 1
- --Bury the light = 18533788866 pitch = 0.67
- --Dion timmer = 5410084870 pitch = 1
- --Come and Go = 15993696418 pitch = 0.5
- --Beat it = 15081051246 pitch = 0.5
- --Never gonna give u up = 16464830611 pitch = 1/0.55
- function start()
- if character:FindFirstChild("VisModel") then
- character["VisModel"]:Destroy()
- root.Sound:Destroy()
- end
- model = Instance.new("Model",character)
- model.Name = "VisModel"
- local fakemodel = Instance.new("Model",character)
- local head = Instance.new("Part",fakemodel) head.Name = "Head" head.Anchored = true head.Size = Vector3.new(0.2,0.2,0.2) head.Transparency = 0
- local mesh = Instance.new("SpecialMesh",head) mesh.Scale = Vector3.new(0,0,0)
- for i=1,maxnumber,size do
- sine += 0.5
- local part = Instance.new("Part") part.Shape = Enum.PartType.Ball part.Name = 1 + #model:GetChildren() part.Material = "Neon" part.Color = Color3.fromRGB(0,0,0) part.Size = Vector3.new(size/2,size/2,0.001) part.Anchored = true part.CanTouch = false part.CanQuery = false part.CanCollide = false part.CastShadow = false
- part.Parent = model
- if i > 1 then
- part.CFrame = lastpart.CFrame * CFrame.new(size/1.5,0,0)
- else
- part.Position = root.Position + Vector3.new(0,5,0)
- end
- lastpart = part
- local cframeValue = Instance.new("CFrameValue")
- cframeValue.Value = part.CFrame
- local sinewave = game:GetService("TweenService"):Create(cframeValue,TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,-1,true),{Value = part.CFrame * CFrame.new(Vector3.new(0,0 + math.rad(size * 130),0))})sinewave:Play()
- table.insert(totalparts,{["Part"] = part,["WaveCFrame"] = cframeValue})
- end
- local number = #totalparts
- music = Instance.new("Sound",head)
- music.SoundId = "rbxassetid://"..soundId
- music.Volume = 1
- music.PlaybackSpeed = songPitch
- music.Looped = true
- music.RollOffMaxDistance = 60
- music.RollOffMode = Enum.RollOffMode.LinearSquare
- local equalizerEffect = Instance.new("EqualizerSoundEffect",music)
- equalizerEffect.HighGain = 10
- equalizerEffect.LowGain = 0
- equalizerEffect.MidGain = 3.7
- local distortionEffect = Instance.new("DistortionSoundEffect",music)
- distortionEffect.Level = 0.1
- fakemodel:PivotTo(model[tostring(math.round(number/2))].CFrame * CFrame.new(0,1,0))
- mainPosition = fakemodel:GetPivot().Position
- local humanoid = Instance.new("Humanoid",fakemodel)
- humanoid.HealthDisplayDistance = 500
- local product = marketPlaceService:GetProductInfo(soundId,Enum.InfoType.Asset)
- if clientVisuals then
- humanoid.DisplayName = "This visualizer requires localscript to be runned(for coolness and potenial blindness)"
- else
- humanoid.DisplayName = "Playing - "..product.Name.."\n Serversided Mode"
- end
- if not clientVisuals then
- localscript = NLS([[
- local event = script:WaitForChild("RemoteEvent")
- local RunService = game:GetService("RunService")
- local sound = owner.Character.Model.Head["Sound"]
- local function fire()
- if sound.PlaybackLoudness ~= 0 then
- event:FireServer(sound.PlaybackLoudness)
- end
- end
- RunService:BindToRenderStep("Fire",5, fire)
- ]],owner.PlayerGui)
- end
- repeat
- task.wait()
- until music.IsLoaded
- for _, player in game:GetService("Players"):GetPlayers() do
- if player.PlayerGui:FindFirstChild(owner.DisplayName.."VisualizerScript") then
- player.PlayerGui:FindFirstChild(owner.DisplayName.."VisualizerScript"):Destroy()
- end
- end
- if clientVisuals then
- task.spawn(function()
- while fakemodel.Parent do
- for _, player in game:GetService("Players"):GetPlayers() do
- if player.Character then
- if (player.Character:GetPivot().Position - fakemodel:GetPivot().Position).Magnitude < 50 then
- if not player.PlayerGui:FindFirstChild(owner.DisplayName.."VisualizerScript") then
- local visScript = NLS([[
- task.wait(3)
- local tweenService = game:GetService("TweenService")
- local player = game:GetService("Players").LocalPlayer
- local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
- local model = script:WaitForChild("Model").Value
- local model2 = script:WaitForChild("Model2").Value
- local fakePosition = script:WaitForChild("TimeStampCFrame")
- local ogTime = script:WaitForChild("ClockTime").Value
- local ogAmbient = script:WaitForChild("Ambient").Value
- local number = script:WaitForChild("TotalParts").Value
- local defaultHue = script:WaitForChild("DefaultHue")
- local defaultSaturation = script:WaitForChild("DefaultSaturation").Value
- local songPlaying = script:WaitForChild("SongPlaying").Value
- local sound = model:WaitForChild("Head")["Sound"]
- local loudness = 0
- local sine = 0
- local spin = 0
- local size = 1
- local camera = workspace.CurrentCamera
- local ogFov = camera.FieldOfView
- local scriptErrored = false
- local turningBack = false
- local nearestParts = {}
- local normalCameraCFrame
- if game.Lighting:FindFirstChild("ColorThing"..player.DisplayName) then
- game.Lighting:FindFirstChild("ColorThing"..player.DisplayName):Destroy()
- end
- local Frame1,Frame2
- local Frame1OgSize,Frame2OgSize = UDim2.new(1, 0, 0.1, 0),UDim2.new(1, 0, 0.1, 0)
- local colorStuff = Instance.new("ColorCorrectionEffect",game.Lighting)
- colorStuff.Name = "ColorThing"..player.DisplayName
- function createCutsceneGui()
- local ScreenGui0 = Instance.new("ScreenGui")
- Frame1 = Instance.new("Frame")
- Frame2 = Instance.new("Frame")
- local TextLabel = Instance.new("TextLabel")
- ScreenGui0.Parent = player.PlayerGui
- ScreenGui0.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- ScreenGui0.ScreenInsets = Enum.ScreenInsets.DeviceSafeInsets
- Frame1.Name = "Top"
- Frame1.Parent = ScreenGui0
- Frame1.Position = UDim2.new(0.5, 0, -0.025, 0)
- Frame1.Size = UDim2.new(1, 0, 0.0500000001, 0)
- Frame1.AnchorPoint = Vector2.new(0.5, 0.5)
- Frame1.BackgroundColor = BrickColor.new("Really black")
- Frame2.Name = "Bottom"
- Frame2.Parent = ScreenGui0
- Frame2.Position = UDim2.new(0.5, 0, 1.025, 0)
- Frame2.Size = UDim2.new(1, 0, 0.0500000001, 0)
- Frame2.AnchorPoint = Vector2.new(0.5, 0.5)
- Frame2.BackgroundColor = BrickColor.new("Really black")
- TextLabel.Size = UDim2.new(1,0,1,0)
- TextLabel.TextScaled = true
- TextLabel.Text = songPlaying
- TextLabel.BackgroundTransparency = 1
- TextLabel.Parent = Frame2
- TextLabel.TextColor3 = Color3.fromRGB(255,255,255)
- end
- function cutsceneActivation(toggle)
- if toggle then
- tweenService:Create(Frame1,TweenInfo.new(2,Enum.EasingStyle.Exponential,Enum.EasingDirection.InOut),{Position = UDim2.new(0.5, 0, 0.023, 0)}):Play()
- tweenService:Create(Frame2,TweenInfo.new(2,Enum.EasingStyle.Exponential,Enum.EasingDirection.InOut),{Position = UDim2.new(0.5, 0, 0.975, 0)}):Play()
- else
- tweenService:Create(Frame1,TweenInfo.new(2,Enum.EasingStyle.Exponential,Enum.EasingDirection.InOut),{Position = UDim2.new(0.5, 0, -0.025, 0)}):Play()
- tweenService:Create(Frame2,TweenInfo.new(2,Enum.EasingStyle.Exponential,Enum.EasingDirection.InOut),{Position = UDim2.new(0.5, 0, 1.025, 0)}):Play()
- end
- end
- function effectParticle(TIME,POSITION,TYPE)
- if TYPE == "Ball" then
- local part = Instance.new("Part")part.Size = Vector3.new(0,0,0) part.Shape = Enum.PartType.Ball part.Material = "Neon" part.Color = Color3.fromRGB(0,0,0) part.Anchored = true part.CanTouch = false part.CanQuery = false part.CanCollide = false part.CastShadow = false
- part.Position = POSITION
- part.Size = Vector3.new(math.clamp(loudness/100,0.1,15),math.clamp(loudness/100,0.1,15),math.clamp(loudness/100,0.1,15))
- part.Parent = model
- part.Color = Color3.fromHSV(defaultHue.Value, defaultSaturation, math.clamp(loudness/100,0.05,1))
- delay(10,function()
- part:Destroy()
- end)
- task.spawn(function()
- repeat
- task.wait()
- if part.Transparency == 1 then break end
- part.Position = part.Position:Lerp(part.Position + Vector3.new(0,math.clamp(loudness/100,0.1,15),0),0.3)
- part.Transparency = part.Transparency + math.clamp(loudness/50000,0,1)
- part.Color = Color3.fromHSV(defaultHue.Value, defaultSaturation, math.clamp(loudness/500,0.05,1))
- until part.Parent == nil or not part
- pcall(function()
- part:Destroy()
- end)
- end)
- end
- end
- task.spawn(function()
- for _, part in pairs(model2:GetChildren()) do
- task.wait(0.05)
- task.spawn(function()
- local mover = 0
- local ogPosition = part.CFrame
- local size2 = part.Size.X
- while true do
- task.wait()
- mover = mover + 1
- if sound.PlaybackLoudness ~= 0 then
- part.Orientation = part.Orientation:Lerp(Vector3.new(part.Orientation.X, part.Orientation.Y, 0 + spin),0.9)
- part.CFrame = part.CFrame:Lerp(ogPosition * CFrame.new(0,math.rad(math.clamp(size2 + (loudness / 3),0.05,100) * math.sin(mover/10)),0),0.9)
- end
- end
- end)
- end
- end)
- task.spawn(function()
- while true do
- task.wait(0.1)
- if loudness/45 > 6 then
- local randomPosition = model:GetPivot().Position + Vector3.new(math.random(-50,50),-6,math.random(-50,50))
- effectParticle(5,randomPosition,"Ball")
- end
- end
- end)
- task.spawn(function()
- while true do
- task.wait()
- for i,part in pairs(model2:GetChildren()) do
- local center = fakePosition.Value
- local magnitude = (part.Position - center.Position).Magnitude * ((number - size) / 600)
- if (part.Position - center.Position).Magnitude < size * 20 then
- table.insert(nearestParts,part)
- end
- end
- task.wait()
- table.clear(nearestParts)
- end
- end)
- createCutsceneGui()
- while true do
- task.wait()
- if scriptErrored then break end
- sine = sine + 1
- loudness = sound.PlaybackLoudness/1.5
- local loudness2 = sound.PlaybackLoudness/20
- spin = (loudness/20) * math.sin(sine/math.clamp(loudness/2,0,50))
- xpcall(function()
- if model2.Parent then end
- end,function()
- scriptErrored = true
- end)
- if not colorStuff.Parent then
- print("rebulding color")
- colorStuff = Instance.new("ColorCorrectionEffect",game.Lighting)
- colorStuff.Name = "ColorThing"..player.DisplayName
- else
- if (player.Character:GetPivot().Position - model:GetPivot().Position).Magnitude > 40 then
- if game.Lighting.ClockTime ~= ogTime then
- tweenService:Create(game.Lighting,TweenInfo.new(0.5,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),{ClockTime = ogTime}):Play()
- end
- colorStuff.TintColor = Color3.fromRGB(255,255,255)
- colorStuff.Enabled = false
- camera.FieldOfView = ogFov
- game.Lighting.Ambient = Color3.fromRGB(70,70,70)
- if camera.CameraType.Name ~= "Custom" then
- camera.CameraType = Enum.CameraType.Custom
- camera.CameraSubject = humanoid
- cutsceneActivation(false)
- end
- else
- if camera.CameraType.Name ~= "Scriptable" then
- camera.CameraType = Enum.CameraType.Scriptable
- camera.CFrame = model:GetPivot() * CFrame.new(0,0,number/2.5) * CFrame.Angles(0,0,0)
- normalCameraCFrame = camera.CFrame
- cutsceneActivation(true)
- end
- tweenService:Create(game.Lighting,TweenInfo.new(0.3,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),{ClockTime = math.clamp(loudness/15,ogTime,24)}):Play()
- colorStuff.Enabled = true
- local TintColor1 = Color3.fromHSV(defaultHue.Value, defaultSaturation, 0 + (loudness/250))
- local TintColor2 = Color3.fromRGB(255,255,255)
- local TintColor3 = TintColor2:Lerp(TintColor1,0.1)
- tweenService:Create(colorStuff,TweenInfo.new(0.05,Enum.EasingStyle.Back,Enum.EasingDirection.Out),{Saturation = math.clamp(loudness / 4000,0,1),TintColor = TintColor3}):Play()
- local AmbientColor2 = Color3.fromRGB(70,70,70)
- local AmbientColor3 = AmbientColor2:Lerp(TintColor1,0.1)
- tweenService:Create(game.Lighting,TweenInfo.new(0.05,Enum.EasingStyle.Exponential,Enum.EasingDirection.Out),{Ambient = AmbientColor3}):Play()
- if normalCameraCFrame then
- tweenService:Create(camera,TweenInfo.new(0.05,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),{CFrame = normalCameraCFrame * CFrame.new(0,0,-math.clamp(loudness/100,0,100))}):Play()
- end
- tweenService:Create(camera,TweenInfo.new(0.05,Enum.EasingStyle.Linear,Enum.EasingDirection.In),{FieldOfView = ogFov - 20 + (loudness / 20)}):Play()
- end
- end
- for _,part in pairs(nearestParts) do
- local center = fakePosition.Value
- local magnitude = (part.Position - center.Position).Magnitude * (size)
- part.Color = part.Color:Lerp(Color3.fromHSV(defaultHue.Value, defaultSaturation, math.clamp(loudness2/magnitude/2,0.05,1)),0.5)
- part.Size = part.Size:Lerp(Vector3.new(size/2,math.clamp(loudness2/magnitude/(size * 1.5),size/2,size * 80),0.001),0.5)
- end
- end
- if colorStuff then
- colorStuff:Destroy()
- end
- script:Destroy()
- ]],player.PlayerGui)
- visScript.Name = owner.DisplayName.."VisualizerScript"
- local objValue = Instance.new("ObjectValue",visScript)
- objValue.Name = "Model"
- objValue.Value = fakemodel
- local obj2Value = Instance.new("ObjectValue",visScript)
- obj2Value.Name = "Model2"
- obj2Value.Value = model
- local clockTimeValue = Instance.new("NumberValue",visScript)
- clockTimeValue.Name = "ClockTime"
- clockTimeValue.Value = game.Lighting.ClockTime
- local ambientValue = Instance.new("Color3Value",visScript)
- ambientValue.Name = "Ambient"
- ambientValue.Value = game.Lighting.Ambient
- local defaultHueValue = Instance.new("NumberValue",visScript)
- defaultHueValue.Name = "DefaultHue"
- defaultHueValue.Value = defaultHue
- local defaultSaturationValue = Instance.new("NumberValue",visScript)
- defaultSaturationValue.Name = "DefaultSaturation"
- defaultSaturationValue.Value = defaultSaturation
- local timestampCFrameValue = Instance.new("CFrameValue",visScript)
- timestampCFrameValue.Name = "TimeStampCFrame"
- timestampCFrameValue.Value = fakePosition.Value
- local totalPartsValue = Instance.new("NumberValue",visScript)
- totalPartsValue.Name = "TotalParts"
- totalPartsValue.Value = #totalparts
- local songPlaying = Instance.new("StringValue",visScript)
- songPlaying.Name = "SongPlaying"
- songPlaying.Value = "Playing - "..product.Name
- task.spawn(function()
- while true do
- task.wait()
- defaultHueValue.Value = defaultHue
- timestampCFrameValue.Value = fakePosition.Value
- end
- end)
- end
- end
- end
- end
- task.wait(3)
- end
- end)
- end
- return #totalparts
- end
- number = start()
- task.spawn(function()
- while true do
- task.wait()
- sine += 1
- --defaultHue = 0.5 + 0.5 * math.sin(sine/30)
- for i,part in totalparts do
- local center = fakePosition.Value
- local magnitude = (part.Part.Position - center.Position).Magnitude * ((number - size) / 600)
- if (part.Part.Position - center.Position).Magnitude < size * 20 then
- table.insert(nearestParts,part)
- end
- end
- task.wait()
- table.clear(nearestParts)
- end
- end)
- if not clientVisuals then
- local event = Instance.new("RemoteEvent",localscript)
- event.OnServerEvent:Connect(function(player,songloudness)
- loudness = songloudness/60
- if player.UserId == owner.UserId then
- for i,part in nearestParts do
- local center = fakePosition.Value
- local magnitude = (part.Part.Position - center.Position).Magnitude * (size)
- part.Part.Color = part.Part.Color:Lerp(Color3.fromHSV(defaultHue, defaultSaturation, math.clamp(loudness/magnitude/10,0.05,1)),0.8)
- part.Part.Size = part.Part.Size:Lerp(Vector3.new(size/2,math.clamp(loudness/magnitude/2/(size/2),size/2,size * 40),0.001),0.8)
- end
- end
- end)
- end
- music:Play()
- function play()
- game:GetService("TweenService"):Create(fakePosition,TweenInfo.new(music.TimeLength/music.PlaybackSpeed),{Value = model[tostring(#model:GetChildren())].CFrame * CFrame.new(0,0,size)}):Play()
- wait(music.TimeLength/music.PlaybackSpeed)
- end
- while task.wait() do
- if music.TimePosition ~= 0 then
- fakePosition.Value = model["1"].CFrame * CFrame.new(0,0,size)
- play()
- else
- fakePosition.Value = model["1"].CFrame * CFrame.new(0,0,size)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement