Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- LOCAL


local Janitor = require(script.Parent.Janitor)
local Enum_ = require(script.Parent.Enum)
local Signal = require(script.Parent.Signal)
local Tracker = require(script.Tracker)
local CollectiveWorldModel = require(script.CollectiveWorldModel)
local enum = Enum_.enums
local players = game:GetService("Players")
local activeZones = {}
local activeZonesTotalVolume = 0
local activeTriggers = {}
local registeredZones = {}
local activeParts = {}
local activePartToZone = {}
local allParts = {}
local allPartToZone = {}
local activeConnections = 0
local runService = game:GetService("RunService")
local heartbeat = runService.Heartbeat
local heartbeatConnections = {}
local localPlayer = runService:IsClient() and players.LocalPlayer
-- Small bug fix where the sound would start playing after the player joined


player.CharacterAdded:Connect(function()
	task.wait(1)
	if currentSound.IsPlaying then
		currentSound:Stop()
	end
end)

while wait() do
	if humanoid.WalkSpeed == 20 then
		currentSound.PlaybackSpeed = 1.75
	elseif humanoid.WalkSpeed ~= 20 then
		currentSound.PlaybackSpeed = 1
	end
end
------------------------------------------------------------------------
--
-- * used in luaK:setmultret(), (lparser) luaY:adjust_assign()
------------------------------------------------------------------------


function luaK:setreturns(fs, e, nresults)
  if e.k == "VCALL" then  -- expression is an open function call?
    luaP:SETARG_C(self:getcode(fs, e), nresults + 1)
  elseif e.k == "VVARARG" then
    luaP:SETARG_B(self:getcode(fs, e), nresults + 1);
    luaP:SETARG_A(self:getcode(fs, e), fs.freereg);
    luaK:reserveregs(fs, 1)
  end
end
--[[
	
	Welds part A to part B using a WeldConstraint (returns weld)
	
	Functions.Weld(
		partA,					<-- |REQ| 	Part instance
		partB,					<-- |REQ|	Part instance
		isManualWeld			<-- 		true = ManualWeld, false = WeldConstraint			[defaults to: false]
	)
	
--]]




return function(a, b, isManualWeld)
	--- Create weld
	local weld = Instance.new((isManualWeld and "ManualWeld" or "WeldConstraint"))
	
	--- Set part adornees
	weld.Part0 = a
	weld.Part1 = b
	
	--- If manual weld, set CFrame
	if isManualWeld then
		weld.C0 = a.CFrame:inverse() * b.CFrame
	end
	
	--- Part to part A
	weld.Parent = a
	
	--
	return weld
end
-- Make signal strict


setmetatable(Signal, {
	__index = function(_tb, key)
		error(("Attempt to get Signal::%s (not a valid member)"):format(tostring(key)), 2)
	end,
	__newindex = function(_tb, key, _value)
		error(("Attempt to set Signal::%s (not a valid member)"):format(tostring(key)), 2)
	end
})

return Signal
--[[Transmission]]


	Tune.TransModes		= {"Auto"}								--[[
	[Modes]
		"Auto"		: Automatic shifting
		"Semi"		: Clutchless manual shifting, dual clutch transmission
		"Manual"	: Manual shifting with clutch
		
		>Include within brackets
			eg: {"Semi"} or {"Auto", "Manual"}								
		>First mode is default mode													]]
	
	--Automatic Settings
	Tune.AutoShiftMode	= "Speed"												--[[
	[Modes]
		"Speed"		: Shifts based on wheel speed
		"RPM"		: Shifts based on RPM											]]	
	Tune.AutoUpThresh	= -200		--Automatic upshift point 	(relative to peak RPM, positive = Over-rev)
	Tune.AutoDownThresh = 1400		--Automatic downshift point (relative to peak RPM, positive = Under-rev)
	
	--Gear Ratios
	Tune.FinalDrive		= 5		-- Gearing determines top speed and wheel torque
	Tune.Ratios			= {				-- Higher ratio = more torque, Lower ratio = higher top speed
		--[[Reverse]]	3.70		,	-- Copy and paste a ratio to add a gear
		--[[Neutral]]	0			,	-- Ratios can also be deleted
		--[[ D ]]		4
		 		,	-- Reverse, Neutral, and 1st gear are required
	}
	Tune.FDMult			= 1.5			-- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
-- LOCAL


local tweenService = game:GetService("TweenService")
local replicatedStorage = game:GetService("ReplicatedStorage")
local debris = game:GetService("Debris")
local userInputService = game:GetService("UserInputService")
local httpService = game:GetService("HttpService") -- This is to generate GUIDs
local runService = game:GetService("RunService")
local textService = game:GetService("TextService")
local guiService = game:GetService("GuiService")
local starterGui = game:GetService("StarterGui")
local players = game:GetService("Players")
local IconController = require(script.IconController)
local Signal = require(script.Signal)
local Maid = require(script.Maid)
local TopbarPlusGui = require(script.TopbarPlusGui)
local TopbarPlusReference = require(script.TopbarPlusReference)
local referenceObject = TopbarPlusReference.getObject()
local Themes = require(script.Themes)
local activeItems = TopbarPlusGui.ActiveItems
local topbarContainer = TopbarPlusGui.TopbarContainer
local iconTemplate = topbarContainer["IconContainer"]
local DEFAULT_THEME = Themes.Default
local THUMB_OFFSET = 55
local DEFAULT_FORCED_GROUP_VALUES = {}
local Icon = (referenceObject and require(referenceObject.Value)) or {}
Icon.__index = Icon
if not referenceObject then
	TopbarPlusReference.addToReplicatedStorage()
end
--// Aim|Zoom|Sensitivity Customization


	ZoomSpeed = 0.15; -- The lower the number the slower and smoother the tween
	AimZoom = 5; -- Default zoom
	AimSpeed = 0.45;
	UnaimSpeed = 0.35;
	CycleAimZoom = 4; -- Cycled zoom
	MouseSensitivity = 0.05; -- Number between 0.1 and 1
	SensitivityIncrement = 0.05; -- No touchy
--raycast


function heardetect(part)
	local target = nil
	local Beam = Instance.new("Part", script.debris)
	Beam.Anchored = true
	Beam.CanCollide = false
	Beam.Color = Color3.fromRGB(255, 150, 150)
	Beam.Material = Enum.Material.Neon
	Beam.Name = "LaserBeam"
	Beam.Transparency = 1
	
	--script.Parent.Torso.Orientation = Vector3.new(script.Parent.Torso.Orientation.X,FindTarget().Orientation.Y-FindTarget().Orientation.Y*2,script.Parent.Torso.Orientation.Z)
	local Object = script.Parent.Head
	local Raycast = Ray.new(Object.CFrame.p, CFrame.new(Object.CFrame.Position, part.Position).LookVector * distance)
	local Part, Position = game.Workspace:FindPartOnRayWithIgnoreList(Raycast, {Object, Beam, script.debris}, false, true)

	local Distance = (Object.CFrame.p - Position).Magnitude
	if visibleray == true then
		Beam.Size = Vector3.new(0.1, 0.1, Distance)
		Beam.CFrame = CFrame.new(Object.CFrame.Position, part.Position) * CFrame.new(0, 0, -Distance/2)
		Beam.Transparency = 0
	else
		Beam:Destroy()
	end
	if Part ~= nil then
		if game.Players:GetPlayerFromCharacter(Part.Parent) or game.Players:GetPlayerFromCharacter(Part.Parent.Parent) then
			--script.Parent.Humanoid:MoveTo(Part.Position)
			GoTo(part.Position)
			if (part.Position - script.Parent.Head.Position).Magnitude < damagerange then
				attack()
			end
			Beam.BrickColor = BrickColor.new("Bright blue")
		else
			Beam.BrickColor = BrickColor.new("Really red")
		end	
	else
		Beam.BrickColor = BrickColor.new("White")
	end
	wait()
end
--banto.Health.Changed:connect(function()
--local hitSound = soundBank[math.random(1,#soundBank)]:Clone()
--hitSound.PlayOnRemove = true
--hitSound.Parent = banto.PrimaryPart
--wait()
--hitSound:Destroy()
--end)



local gruntCoroutine = coroutine.wrap(function()
	while wait(math.random(30,60)) do
		local soundBank = banto.Head:GetChildren()
		local randomSound = soundBank[math.random(1,#soundBank)]
		randomSound:Play()
	end
end)
gruntCoroutine()

while true do
	bp.Parent = banto.PrimaryPart
	local goal
	repeat 
		local ray = Ray.new(
			Vector3.new(origin.p.x+math.random(-tether,tether),100,origin.p.z+math.random(-tether,tether)),
			Vector3.new(0,-1000,0)
			)
		local part,pos,norm,mat = workspace:FindPartOnRay(ray,banto)
		if part == workspace.Terrain and mat ~= Enum.Material.Water then
			goal = pos+Vector3.new(0,2.25,0)
		end
		wait()
	until goal
	-- move the banto to the newfound goal
	walk:Play()
	bg.CFrame = CFrame.new(banto.PrimaryPart.Position,goal)
	bp.Position = (CFrame.new(banto.PrimaryPart.Position,goal)*CFrame.new(0,0,-100)).p

	local start = tick()
	repeat wait(1/2) 
		local ray = Ray.new(banto.PrimaryPart.Position,Vector3.new(0,-1000,0))
		--local part,pos,norm,mat = workspace:FindPartOnRay(ray,banto)
		--banto:MoveTo(Vector3.new(banto.PrimaryPart.Position.X,pos.Y+2.25,banto.PrimaryPart.Position.Z))
		--bp.Position = Vector3.new(bp.Position.X,pos.Y+2.25,bp.Position.Z)

	until (banto.PrimaryPart.Position-goal).magnitude < 10 or tick()-start >10
	walk:Stop()
	bp.Parent = nil
	wait(math.random(3,8))
end
-- Note: The active transparency controller could be made to listen for this event itself.


function CameraModule:OnCameraSubjectChanged()
	local camera = workspace.CurrentCamera
	local cameraSubject = camera and camera.CameraSubject

	if self.activeTransparencyController then
		self.activeTransparencyController:SetSubject(cameraSubject)
	end

	if self.activeOcclusionModule then
		self.activeOcclusionModule:OnCameraSubjectChanged(cameraSubject)
	end

	self:ActivateCameraController(nil, camera.CameraType)
end

function CameraModule:OnCameraTypeChanged(newCameraType: Enum.CameraType)
	if newCameraType == Enum.CameraType.Scriptable then
		if UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter then
			CameraUtils.restoreMouseBehavior()
		end
	end

	-- Forward the change to ActivateCameraController to handle
	self:ActivateCameraController(nil, newCameraType)
end
--------------------------PC AUTO JUMPER-------------------------------



local function GetCharacter()
	return Player and Player.Character
end

local function GetTorso()
	local humanoid = findPlayerHumanoid(Player)
	return humanoid and humanoid.Torso
end

local function IsPartAHumanoid(part)
	return part and part.Parent and (part.Parent:FindFirstChild('Humanoid') ~= nil)
end

local function doAutoJump()
	local character = GetCharacter()
	if (character == nil) then
		return;
	end

	local humanoid = findPlayerHumanoid(Player)
	if (humanoid == nil) then
		return;
	end

	local rayLength = 1.5;
	-- This is how high a ROBLOXian jumps from the mid point of his torso
	local jumpHeight = 7.0;

	local torso = GetTorso()
	if (torso == nil) then
		return;
	end

	local torsoCFrame = torso.CFrame;
	local torsoLookVector = torsoCFrame.lookVector;
	local torsoPos = torsoCFrame.p;

	local torsoRay = Ray.new(torsoPos + Vector3_new(0, -torso.Size.Y/2, 0), torsoLookVector * rayLength);
	local jumpRay = Ray.new(torsoPos + Vector3_new(0, jumpHeight - torso.Size.Y, 0), torsoLookVector * rayLength);

	local hitPart, _ = RayCastIgnoreList(workspace, torsoRay, {character}, false)
	local jumpHitPart, _ = RayCastIgnoreList(workspace, jumpRay, {character}, false)

	if (hitPart and jumpHitPart == nil and hitPart.CanCollide == true) then
		 -- NOTE: this follow line is not in the C++ impl, but an improvement  in Click to Move
		if not IsPartAHumanoid(hitPart) then
			humanoid.Jump = true;
		end
	end
end

local NO_JUMP_STATES =
{
	[Enum.HumanoidStateType.FallingDown] = false;
	[Enum.HumanoidStateType.Flying] = false;
	[Enum.HumanoidStateType.Freefall] = false;
	[Enum.HumanoidStateType.GettingUp] = false;
	[Enum.HumanoidStateType.Ragdoll] = false;
	[Enum.HumanoidStateType.Running] = false;
	[Enum.HumanoidStateType.Seated] = false;
	[Enum.HumanoidStateType.Swimming] = false;

	-- Special case to detect if we are on a ladder
	[Enum.HumanoidStateType.Climbing] = false;
}

local function enableAutoJump()
	local humanoid = findPlayerHumanoid(Player)
	local currentState = humanoid and humanoid:GetState()
	if currentState then
		return NO_JUMP_STATES[currentState] == nil
	end
	return false
end

local function getAutoJump()
	return true
end

local function vec3IsZero(vec3)
	return vec3.magnitude < 0.05
end
-- Local Functions


local function setCollisionGroupForPart(part)
	if part:IsA("BasePart") then
		previousCollisionGroups[part] = part.CollisionGroupId
		PhysicsService:SetPartCollisionGroup(part, playerCollisionGroupName)
	end
end
 
local function setCollisionGroupForObject(object)
	setCollisionGroupForPart(object)
	for _, object in ipairs(object:GetDescendants()) do
		setCollisionGroupForPart(object)
	end
end
 
local function resetCollisionGroup(object)
	local previousCollisionGroupId = previousCollisionGroups[object]
	if not previousCollisionGroupId then return end 
 
	local previousCollisionGroupName = PhysicsService:GetCollisionGroupName(previousCollisionGroupId)
	if not previousCollisionGroupName then return end
 
	PhysicsService:SetPartCollisionGroup(object, previousCollisionGroupName)
	previousCollisionGroups[object] = nil
end
 
local function onCharacterAdded(character)
	setCollisionGroupForObject(character)
 
	character.DescendantAdded:Connect(setCollisionGroupForPart)
	character.DescendantRemoving:Connect(resetCollisionGroup)
end
 
local function onPlayerAdded(player)
	player.CharacterAdded:Connect(onCharacterAdded)
end
-- Called when any relevant values of GameSettings or LocalPlayer change, forcing re-evalulation of
-- current control scheme


function ControlModule:OnComputerMovementModeChange()
	local controlModule, success =  self:SelectComputerMovementModule()
	if success then
		self:SwitchToController(controlModule)
	end
end

function ControlModule:OnTouchMovementModeChange()
	local touchModule, success = self:SelectTouchModule()
	if success then
		while not self.touchControlFrame do
			wait()
		end
		self:SwitchToController(touchModule)
	end
end

function ControlModule:CreateTouchGuiContainer()
	if self.touchGui then self.touchGui:Destroy() end

	-- Container for all touch device guis
	self.touchGui = Instance.new('ScreenGui')
	self.touchGui.Name = "TouchGui"
	self.touchGui.ResetOnSpawn = false
	self.touchGui.Enabled = self.humanoid ~= nil

	self.touchControlFrame = Instance.new("Frame")
	self.touchControlFrame.Name = "TouchControlFrame"
	self.touchControlFrame.Size = UDim2.new(1, 0, 1, 0)
	self.touchControlFrame.BackgroundTransparency = 1
	self.touchControlFrame.Parent = self.touchGui

	self.touchGui.Parent = self.playerGui
end

function ControlModule:GetClickToMoveController()
	if not self.controllers[ClickToMove] then
		self.controllers[ClickToMove] = ClickToMove.new(CONTROL_ACTION_PRIORITY)
	end
	return self.controllers[ClickToMove]
end

return ControlModule.new()
--[=[
	@class Input

	The Input module provides access to various user input classes.

	- [PreferredInput](/api/PreferredInput)
	- [Mouse](/api/Mouse)
	- [Keyboard](/api/Keyboard)
	- [Touch](/api/Touch)
	- [Gamepad](/api/Gamepad)

	```lua
	local Input = require(packages.Input)

	local PreferredInput = Input.PreferredInput
	local Mouse = Input.Mouse
	local Keyboard = Input.Keyboard
	local Touch = Input.Touch
	local Gamepad = Input.Gamepad
	```
]=]


local Input = {
	PreferredInput = require(script.PreferredInput),
	Mouse = require(script.Mouse),
	Keyboard = require(script.Keyboard),
	Touch = require(script.Touch),
	Gamepad = require(script.Gamepad),
}

return Input
--[[
	Stage implementation
]]



local Waiting = {}
Waiting.__index = Waiting

function Waiting.new(gameStageHandler)
	local self = setmetatable({
		gameStageHandler = gameStageHandler,
	}, Waiting)

	return self
end

function Waiting:disableQueueTimeout()
	self._disableQueueTimeout = true
end

function Waiting:startGame(...)
	MatchmakingDestination.startGame(...)
end

function Waiting:initialize()
	-- Spawn every player onto the boat
	for _, player in pairs(Players:GetPlayers()) do
		Util.loadCharacter(player)
	end

	spawn(function()
		DamageHandler.setup()
	end)

	MatchmakingDestination.run(function() self.gameStageHandler:nextStage() end)

	spawn(function()
			while not MatchmakingDestination.isPlaying() do
				if self.gameStageHandler.currentStageClassName ~= "Waiting" or self._disableQueueTimeout then
					return
				end

				local waitTime = tick() - self.gameStageHandler.timeStageStarted

				if waitTime < Conf.queue_time_limit or #Players:getPlayers() < Conf.min_queue_players then
					wait(1)
					self.gameStageHandler._queueWaitTime = waitTime

				else
					MatchmakingDestination.startGame()
					break
				end
			end
	end)
end

function Waiting:destroy()
	-- TODO:  Any teardown for MatchmakingDestination

	-- Reset the character back to the default state
	for _, player in pairs(Players:GetPlayers()) do
		if player.Character then
			-- Remove the force field from the character
			local forceField = player.Character:FindFirstChild("WaitingForceField")
			if forceField then
				forceField:Destroy()
			end

			-- Remove all equipped tools that are not the building tool
			for _, instance in pairs(player.Character:GetChildren()) do
				if instance:IsA("Tool") then
					instance:Destroy()
				end
			end
		end

		-- Remove all tools from the player's backpack that are not the building tool
		for _, instance in pairs(player.Backpack:GetChildren()) do
			if instance:IsA("Tool") then
				instance:Destroy()
			end
		end
	end
end
---Misc


function Misc()
	local function GetHelp()
		local a=false
		for i=1,9 do
			a=not a
			wait(.2)
			if a then
				script.Parent.Help.Style=Enum.ButtonStyle.RobloxRoundDropdownButton
			else
				script.Parent.Help.Style=Enum.ButtonStyle.RobloxRoundDefaultButton
			end
		end
	end
	GetHelp()
	script.Parent.Help.MouseButton1Click:connect(function()
		script.Parent.Controls.Visible=not script.Parent.Controls.Visible
	end)
	script.Parent:WaitForChild("Light")
	local light=0
	local function Light(on)
		for i,v in pairs(car.Body.Lights:GetChildren()) do
			if v:FindFirstChild("Light")~=nil then
				v.Light.Enabled=on
			end
			if on and v.BrickColor~=BrickColor.new("Really black") then
				v.Material=Enum.Material.Neon
			else
				v.Material=Enum.Material.SmoothPlastic
			end
		end
	end
	local function AutoLight()
		if light==0 then
			if (game.Lighting:GetMinutesAfterMidnight()<390 or game.Lighting:GetMinutesAfterMidnight()>1050) then
				Light(true)
			else
				Light(false)
			end
		end
	end
	script.Parent.Light.MouseButton1Click:connect(function()
		if light==1 then
			light=-1
		else
			light=light+1
		end
		if light==0 then
			script.Parent.Light.Text="Lights: Auto"
			if game.Lighting:GetMinutesAfterMidnight()<390 or game.Lighting:GetMinutesAfterMidnight()>1050 then
				Light(true)
			else
				Light(false)
			end
		elseif light==1 then
			script.Parent.Light.Text="Lights: On"
			Light(true)
		else
			script.Parent.Light.Text="Lights: Off"
			Light(false)
		end
	end)
	local function BrakeLights()
		for i,v in pairs(car.Body.Lights:GetChildren()) do
			if v.Name=="R" then
				if v.Light.Enabled then
					if GBrake>0 then
						v.Transparency=0
						v.Light.Brightness=12
					else
						v.Transparency=.3
						v.Light.Brightness=8
					end
				else
					if GBrake>0 then
						v.Material=Enum.Material.Neon
					else
						v.Material=Enum.Material.SmoothPlastic
					end
				end
			end
		end
	end
	game.Lighting.Changed:connect(AutoLight)
	AutoLight()
	local FlipWait=tick()
	local FlipDB=false
	local function FlipCar()
		local gyro = car.DriveSeat.Flip
		gyro.maxTorque = Vector3.new(10000,0,10000)
		gyro.P=3000
		gyro.D=500
		wait(2)
		gyro.maxTorque = Vector3.new(0,0,0)
		gyro.P=0
		gyro.D=0
		FlipDB=false
	end
	local function GetFlip()
		if (car.DriveSeat.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector.y > .1 or FlipDB then
			FlipWait=tick()
		else
			if tick()-FlipWait>=3 then
				FlipDB=true
				FlipCar()
			end
		end
	end
	--run:BindToRenderStep("BrakeL",Enum.RenderPriority.Last.Value,BrakeLights)
	--run:BindToRenderStep("Flip",Enum.RenderPriority.Last.Value,GetFlip)
	--table.insert(Binded,"BrakeL")
	--table.insert(Binded,"Flip")
	table.insert(LoopRun,BrakeLights)
	table.insert(LoopRun,GetFlip)
end
Misc()
-- Copied from Grimgold Periastron Beta



local Tool = script.Parent
local Sword = Tool.Handle

local vCharacter
local myTorso
local myHumanoid 

local equipped = false

local debris = game:GetService("Debris")

function tagHumanoid(humanoid, player)
	if humanoid then 
		local creatorTag = Instance.new("ObjectValue")
		creatorTag.Value = player
		creatorTag.Name = "creator"
		creatorTag.Parent = humanoid
		debris:AddItem(creatorTag, 1)
	end
end

function cut(hit)
	local humanoid
	local vPlayer
	if hit and hit.Parent and myHumanoid then 
		if hit.Parent.className == "Hat" then
			humanoid = hit.Parent.Parent:FindFirstChild("Humanoid")
		else
			humanoid = hit.Parent:FindFirstChild("Humanoid")
		end
		vPlayer = game.Players:GetPlayerFromCharacter(vCharacter)
		if humanoid ~= nil and humanoid ~= myHumanoid then 
			tagHumanoid(humanoid, vPlayer)
			humanoid:TakeDamage(7.5)
		end
	end
end

function onEquipped()
	vCharacter = Tool.Parent
	myTorso = vCharacter:FindFirstChild("Torso")
	myHumanoid = vCharacter:FindFirstChild("Humanoid")	
end

Tool.Equipped:connect(onEquipped)

Sword.Touched:connect(cut)
--[=[
	@within TableUtil
	@function Assign
	@param target table
	@param ... table
	@return table

	Copies all values of the given tables into the `target` table.

	```lua
	local t = {A = 10}
	local t2 = {B = 20}
	local t3 = {C = 30, D = 40}
	local newT = TableUtil.Assign(t, t2, t3)
	print(newT) --> {A = 10, B = 20, C = 30, D = 40}
	```
]=]


local function Assign<T>(target: { T }, ...: { any }): { T } & { any }
	local tbl = table.clone(target)
	for _, src in { ... } do
		for k, v in src do
			tbl[k] = v
		end
	end
	return tbl
end
--[[**
	ensure value is an Instance and it's ClassName matches the given ClassName by an IsA comparison

	@param className The class name to check for

	@returns A function that will return true iff the condition is passed
**--]]


function t.instanceIsA(className, childTable)
	assert(t.string(className))

	local childrenCheck
	if childTable ~= nil then
		childrenCheck = t.children(childTable)
	end

	return function(value)
		local instanceSuccess = t.Instance(value)
		if not instanceSuccess then
			return false
		end

		if not value:IsA(className) then
			return false
		end

		if childrenCheck then
			local childrenSuccess = childrenCheck(value)
			if not childrenSuccess then
				return false
			end
		end

		return true
	end
end
--[=[
	Takes a list of variables and uses them to compute an observable that
	will combine into any value. These variables can be any value, and if they
	can be converted into an Observable, they will be, which will be used to compute
	the value.

	```lua
	local verbState = Blend.State("hi")
	local nameState = Blend.State("alice")

	local computed = Blend.Computed(verbState, nameState, function(verb, name)
		return verb .. " " .. name
	end)

	maid:GiveTask(computed:Subscribe(function(sentence)
		print(sentence)
	end)) --> "hi alice"

	nameState.Value = "bob" --> "hi bob"
	verbState.Value = "bye" --> "bye bob"
	nameState.Value = "alice" --> "bye alice"
	```

	@param ... A series of convertable states, followed by a function at the end.
	@return Observable<T>
]=]


function Blend.Computed(...)
	local values = {...}
	local n = select("#", ...)
	local compute = values[n]

	assert(type(compute) == "function", "Bad compute")

	local args = {}
	for i=1, n - 1 do
		local observable = Blend.toPropertyObservable(values[i])
		if observable then
			args[i] = observable
		else
			args[i] = Rx.of(values[i])
		end
	end

	if #args == 0 then
		-- static value?
		return Observable.new(function(sub)
			sub:Fire(compute())
		end)
	elseif #args == 1 then
		return Rx.map(compute)(args[1])
	else
		return Rx.combineLatest(args)
			:Pipe({
				Rx.map(function(result)
					return compute(unpack(result, 1, n - 1))
				end);
			})
	end
end
-- periodically pick one of the workspace.Music's children and play song, never pick last



Songs = workspace.Music:GetChildren()

local LastSong
local Song

task.wait(3)

while true do
	
	repeat
		task.wait()
		Song = Songs[math.random(1, #workspace.Music:GetChildren())]
	until Song ~= LastSong

	LastSong = Song
	Song:Play()
	
	task.wait(Song.TimeLength)
	
	task.wait(math.random(1,60))
end