Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Workspace = game:GetService("Workspace")
- local RunService = game:GetService("RunService")
- local scriptParent = Workspace
- local switched = false
- local Character = owner.Character
- script.Name = "BeepBoopSkyway"
- script.Parent = scriptParent
- local root = Character:GetDescendants()
- for _,prt in ipairs(root) do
- if prt:IsA("BasePart") then
- root=prt
- break
- end
- end
- local Music = Instance.new("Sound",root)
- Music.Looped = true
- Music.Volume = 1
- Music.SoundId = "rbxassetid://13206817804"
- Music.PlaybackSpeed = 1
- Instance.new("ObjectValue", script).Value = Music
- Music:Play()
- if not Music.IsLoaded then
- Music.Loaded:Wait()
- end
- local Start = os.clock()
- local function updateSync()
- for _, Script in ipairs(scriptParent:GetChildren()) do
- if Script.ClassName == "Script" and Script.Name == "BeepBoopSkyway" and Script:GetAttribute("Start") ~= nil and tonumber(Script:GetAttribute("Start")) then
- Start = tonumber(Script:GetAttribute("Start"))
- break
- end
- end
- end
- scriptParent.ChildRemoved:Connect(updateSync)
- scriptParent.ChildAdded:Connect(updateSync)
- updateSync() -- Little messy, have to do this cause _G is bit messed up on LSB rn.
- Music.TimePosition = (os.clock() - Start) % Music.TimeLength
- Music:Play()
- local Highlight = Instance.new("Highlight", script)
- Highlight.OutlineColor = Color3.new(1,1,1)
- Highlight.Adornee = Character
- Highlight.DepthMode = Enum.HighlightDepthMode.Occluded
- local NextWhiteTime = 2.5
- local DoNext = true
- RunService.Heartbeat:Connect(function()
- script:SetAttribute("Start", Start)
- local TimePosition = Music.TimePosition - 0.75
- local Time = TimePosition % 4
- local FlashTime = (TimePosition * 2) % 1
- local FlashValue = (Time >= 2.5 and Time < 4) and math.clamp((1 - FlashTime),0,1) or 0
- local Color = (4 > (TimePosition % 8) and Color3.fromRGB(switched and 0 or 255,0,switched and 255 or 0) or Color3.fromRGB(switched and 255 or 0,0,switched and 0 or 255)):Lerp(Color3.fromRGB(255,255,255),FlashValue)
- Highlight.FillTransparency = (1 - FlashValue) / 4 + 0.25
- Highlight.OutlineTransparency = 1 - FlashValue
- Highlight.FillColor = Color
- end)
- owner.Chatted:Connect(function(msg)
- if string.sub(msg,1,3) == "/e " then
- msg = string.sub(msg,4)
- end
- if string.sub(msg,1,1) == "," then
- local cmd = string.sub(msg,2)
- if string.sub(cmd,1,6) == "switch" then
- switched = not switched
- elseif string.sub(cmd,1,4) == "sync" then
- for _, Script in ipairs(scriptParent:GetChildren()) do -- This code could be better.
- if Script.ClassName == "Script" and Script.Name == "BeepBoopSkyway" and Script:GetAttribute("Start") ~= nil and tonumber(Script:GetAttribute("Start")) then
- local SoundValue = Script:FindFirstChildOfClass("ObjectValue")
- if not SoundValue or not SoundValue.Value or SoundValue.Value.ClassName ~= "Sound" then
- continue
- end
- SoundValue.Value.TimePosition = (os.clock() - tonumber(Script:GetAttribute("Start"))) % SoundValue.Value.TimeLength
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement