Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[[ Public API ]]

--
function MasterControl:Init()
	RunService:BindToRenderStep("MasterControlStep", Enum.RenderPriority.Input.Value, updateMovement)
end

function MasterControl:Enable()
	areControlsEnabled = true
	isJumpEnabled = true
	
	if self.ControlState.Current then
		self.ControlState.Current:Enable()
	end
end

function MasterControl:Disable()
	
	if self.ControlState.Current then
		self.ControlState.Current:Disable()
	end
	
	--After current control state is disabled, moveValue has been set to zero,
	--Call updateMovement one last time to make sure this propagates to the engine -
	--Otherwise if disabled while humanoid is moving, humanoid won't stop moving.
	updateMovement()
	
	isJumping = false
	areControlsEnabled = false
end

function MasterControl:EnableJump()
	isJumpEnabled = true
	if areControlsEnabled and self.ControlState:IsTouchJumpModuleUsed() then
		self.TouchJumpModule:Enable()
	end
end

function MasterControl:DisableJump()
	isJumpEnabled = false
	if self.ControlState:IsTouchJumpModuleUsed() then
		self.TouchJumpModule:Disable()
	end
end

function MasterControl:AddToPlayerMovement(playerMoveVector)
	moveValue = Vector3.new(moveValue.X + playerMoveVector.X, moveValue.Y + playerMoveVector.Y, 0)
end

function MasterControl:GetMoveVector()
	return moveValue
end

function MasterControl:SetIsJumping(jumping)
	if not isJumpEnabled then return end
	isJumping = jumping
	local humanoid = self:GetHumanoid()
	if humanoid and not humanoid.PlatformStand then
		humanoid.Jump = isJumping
	end
end

function MasterControl:DoJump()
	if not isJumpEnabled then return end
	local humanoid = self:GetHumanoid()
	if humanoid then
		humanoid.Jump = true
	end
end

function MasterControl:GetClickToMoveFailStateChanged()
	return clickToMoveFailStateChanged
end

return MasterControl
--[=[
	Returns an observable that takes in a tuple, and emits that tuple, then
	completes.

	```lua
	Rx.packed("a", "b")
		:Subscribe(function(first, second)
			print(first, second) --> a, b
		end)
	```

	@param ... any
	@return Observable
]=]


function Rx.packed(...)
	local args = table.pack(...)

	return Observable.new(function(sub)
		sub:Fire(unpack(args, 1, args.n))
		sub:Complete()
	end)
end
-- Private



function ViewportWindow:_createVPF(name, zindex)
	local vpf = Instance.new("ViewportFrame")
	vpf.LightColor = Color3.new(0, 0, 0)
	vpf.Size = UDim2.new(1, 0, 1, 0)
	vpf.Position = UDim2.new(0, 0, 0, 0)
	vpf.AnchorPoint = Vector2.new(0, 0)
	vpf.BackgroundTransparency = 1
	vpf.LightDirection = -Lighting:GetSunDirection()
	vpf.Ambient = Lighting.Ambient
	vpf.Name = name
	vpf.ZIndex = zindex
	vpf.CurrentCamera = self.camera
	vpf.Parent = self.surfaceGui

	return vpf
end

function ViewportWindow:_refreshVisibility(cameraCFrame, surfaceCFrame, surfaceSize, marginOfError)
	local aabbCF, aabbSize = Helpers.getAABB({
		surfaceCFrame * Vector3.new(-surfaceSize.X / 2 + marginOfError, surfaceSize.Y / 2 - marginOfError, -marginOfError),
		surfaceCFrame * Vector3.new(surfaceSize.X / 2 - marginOfError, surfaceSize.Y / 2 - marginOfError, -marginOfError),
		surfaceCFrame * Vector3.new(surfaceSize.X / 2 - marginOfError, -surfaceSize.Y / 2 + marginOfError, -marginOfError),
		surfaceCFrame* Vector3.new(-surfaceSize.X / 2 + marginOfError, -surfaceSize.Y / 2 + marginOfError, -marginOfError),
		cameraCFrame.Position,
	})
	
	-- region3 is more performant tmk over newer API which allows rotation (which we don't need)
	-- local overlap = self.worldRoot:GetPartBoundsInBox(aabbCF, aabbSize)
	local overlap = self.worldRoot:FindPartsInRegion3(Region3.new(
		aabbCF.Position + aabbSize / 2,
		aabbCF.Position - aabbSize / 2
	), nil, math.huge)
	
	local overlapped = {}
	for _, part in pairs(overlap) do
		part.LocalTransparencyModifier = 1
		overlapped[part] = true
	end
	
	for _, instance in pairs(self.worldRoot:GetDescendants()) do
		if instance:IsA("BasePart") and not overlapped[instance] then
			instance.LocalTransparencyModifier = 0
		end
	end
end
--[[
	Create a composite reducer from a map of keys and sub-reducers.
]]


local function combineReducers(map)
	return function(state, action)
		-- If state is nil, substitute it with a blank table.
		if state == nil then
			state = {}
		end

		local newState = {}

		for key, reducer in pairs(map) do
			-- Each reducer gets its own state, not the entire state table
			newState[key] = reducer(state[key], action)
		end

		return newState
	end
end

return combineReducers
--[[
	A ref is nothing more than a binding with a special field 'current'
	that maps to the getValue method of the binding
]]


local Binding = require(script.Parent.Binding)

local function createRef()
	local binding, _ = Binding.create(nil)

	local ref = {}

	--[[
		A ref is just redirected to a binding via its metatable
	]]
	setmetatable(ref, {
		__index = function(_self, key)
			if key == "current" then
				return binding:getValue()
			else
				return binding[key]
			end
		end,
		__newindex = function(_self, key, value)
			if key == "current" then
				error("Cannot assign to the 'current' property of refs", 2)
			end

			binding[key] = value
		end,
		__tostring = function(_self)
			return ("RoactRef(%s)"):format(tostring(binding:getValue()))
		end,
	})

	return ref
end

return createRef
--[[Engine]]


	--Torque Curve
	Tune.Horsepower		= 203		--	[TORQUE CURVE VISUAL]
	Tune.IdleRPM		= 700		--		https://www.desmos.com/calculator/2uo3hqwdhf
	Tune.PeakRPM		= 6500		--		Use sliders to manipulate values
	Tune.Redline		= 7000.01		--		Copy and paste slider values into the respective tune values
	Tune.EqPoint		= 6500
	Tune.PeakSharpness	= 7.5
	Tune.CurveMult		= 0.16
	
	--Incline Compensation
	Tune.InclineComp	= 1.7			-- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
	
	--Misc
	Tune.RevAccel		= 100		-- RPM acceleration when clutch is off
	Tune.RevDecay		= 75		-- RPM decay when clutch is off
	Tune.RevBounce		= 500		-- RPM kickback from redline
	Tune.IdleThrottle	= 3			-- Percent throttle at idle
	Tune.ClutchTol		= 500		-- Clutch engagement threshold (higher = faster response)
-- -- -- -- -- -- --
--DIRECTION SCROLL--
-- -- -- -- -- -- --



This.Parent.Parent.Parent.Parent.Parent:WaitForChild("Direction").Changed:connect(function(val)
	if val == 1 then
		for R = 1, 7 do
			for D = 1, 5 do
				This.Display["Matrix"..1]["Row"..R]["D"..D].ImageColor3 = UColor
			end
		end
		repeat
			SetDisplay(1,"U0")
			wait(ArrowDelay)
			SetDisplay(1,"U1")
			wait(ArrowDelay)
			SetDisplay(1,"U2")
			wait(ArrowDelay)
			SetDisplay(1,"U3")
			wait(ArrowDelay)
			SetDisplay(1,"U4")
			wait(ArrowDelay)
			SetDisplay(1,"U5")
			wait(ArrowDelay)
			SetDisplay(1,"U6")
			wait(ArrowDelay)
		until This.Parent.Parent.Parent.Parent.Parent.Direction.Value ~= 1
		SetDisplay(1,"NIL")
	elseif val == -1 then
		for R = 1, 7 do
			for D = 1, 5 do
				This.Display["Matrix"..1]["Row"..R]["D"..D].ImageColor3 = DColor
			end
		end
		repeat
			SetDisplay(1,"D0")
			wait(ArrowDelay)
			SetDisplay(1,"D1")
			wait(ArrowDelay)
			SetDisplay(1,"D2")
			wait(ArrowDelay)
			SetDisplay(1,"D3")
			wait(ArrowDelay)
			SetDisplay(1,"D4")
			wait(ArrowDelay)
			SetDisplay(1,"D5")
			wait(ArrowDelay)
			SetDisplay(1,"D6")
			wait(ArrowDelay)
		until This.Parent.Parent.Parent.Parent.Parent.Direction.Value ~= -1
		SetDisplay(1,"NIL")
	else
		SetDisplay(1,"NIL")
	end
end)
--// # key, ManOff


mouse.KeyUp:connect(function(key)
	if key=="f" then 
		veh.Lightbar.middle.Man:Stop()
		veh.Lightbar.middle.Wail.Volume = 3
		veh.Lightbar.middle.Yelp.Volume = 3
		veh.Lightbar.middle.Priority.Volume = 3
		script.Parent.Parent.Sirens.Man.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
		veh.Lightbar.MANUAL.Transparency = 1
	end
end)

mouse.KeyDown:connect(function(key)
	if key=="j" then 
		veh.Lightbar.middle.Beep:Play()
veh.Lightbar.RemoteEvent:FireServer(true)
	end
	end)
mouse.KeyDown:connect(function(key)
	if key=="k" then
		veh.Lightbar.middle.Beep:Play()
veh.Lightbar.TAEvent:FireServer(true)
	end
	end)

mouse.KeyDown:connect(function(key)
	if key=="b" then
		veh.Lightbar.middle.Beep:Play()
veh.Lightbar.AlleyEvent:FireServer(true)
	end
	end)

mouse.KeyDown:connect(function(key)
	if key=="v" then
		veh.Lightbar.middle.Beep:Play()
veh.Lightbar.TKDNEvent:FireServer(true)
	end
	end)
--// Recoil Settings	


	gunrecoil = -1; -- How much the gun recoils backwards when not aiming
	camrecoil = 0.3; -- How much the camera flicks when not aiming
	AimGunRecoil = -1; -- How much the gun recoils backwards when aiming
	AimCamRecoil = 0.3; -- How much the camera flicks when aiming
	
	CamShake = 28; -- THIS IS NEW!!!! CONTROLS CAMERA SHAKE WHEN FIRING
	AimCamShake = 24; -- THIS IS ALSO NEW!!!!
	
	Kickback = 17.11; -- Upward gun rotation when not aiming
	AimKickback = 17.11; -- Upward gun rotation when aiming
--LIGHTING FUNCTIONS



script.Parent.OnServerEvent:connect(function(pl,n) if lt~=1 then pr = true else pr=false end lt=n
	if (lt == 0 or lt == 1) then
		RefMt.DesiredAngle = RefMt.CurrentAngle%math.rad(360)
		RefMt.CurrentAngle = RefMt.CurrentAngle%math.rad(360)
		UpdateLt(1,white)
		UpdatePt(false,white)
		StopMt(pr)
		repeat wait() until (lt~=0 and lt~=1)
	elseif lt == 2 then
		UpdateLt(.25,white)
		UpdatePt(true,white)
		UpdateMt(0,9e9,1)
		repeat
			if math.deg(RefMt.CurrentAngle%math.rad(360)) >= 90 then UpdateLt(.25,white) end
			if math.deg(RefMt.CurrentAngle%math.rad(360)) >= 90 then UpdatePt(true,white) end
			if math.deg(RefMt.CurrentAngle%math.rad(360)) >= 270 then UpdateLt(.25,red) end
			if math.deg(RefMt.CurrentAngle%math.rad(360)) >= 270 then UpdatePt(true,red) end
			wait()
		until lt~=2
	elseif lt == 3 then
		UpdateLt(.25,red)
		UpdatePt(true,red)
		UpdateMt(0,9e9,1)
		repeat wait() until lt~=3
	end
end)
-- by default, warns


local function warnWithTracebackOnError(func, shouldNotWarn)
	return xpcall(func, function(err)
		if not shouldNotWarn then
			warn(tostring(err) .. "\n" .. debug.traceback())
		end
		return false, err
	end)
end

function SafeSpawn.new(func, shouldNotWarn)
	local success, err = warnWithTracebackOnError(coroutine.wrap(func), shouldNotWarn)
	if not success and not shouldNotWarn then
		warn(err)
	end
	return success, err
end

return SafeSpawn
----------------------------------------------------------------------------------------------------
--------------------=[ CFRAME ]=--------------------------------------------------------------------
----------------------------------------------------------------------------------------------------


	,EnableHolster = false
	,HolsterTo = 'Torso'				 -- Put the name of the body part you wanna holster to
	,HolsterPos = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))
	
	,RightArmPos = CFrame.new(-.815, 0.55, -1.1) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))	--Server
	,LeftArmPos = CFrame.new(.815,0.55,-1.15) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0))	--server
	
	,ServerGunPos = CFrame.new(-.3, -1, -0.4) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))
	,GunPos = CFrame.new(0.3, -0.15, 1) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(0))

	,RightPos = CFrame.new(-.815, 0.15, -1.1) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))	--Client
	,LeftPos = CFrame.new(.815,0.15,-1.15) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0))	--Client
}

return Config
-------------------------



mouse.KeyDown:connect(function (key)
	key = string.lower(key)
	if key == "c" then --Camera controls
		if cam == ("car") then
			Camera.CameraSubject = player.Character.Humanoid
			Camera.CameraType = ("Custom")
			cam = ("freeplr")
			Camera.FieldOfView = 70
			limitButton.Text = "Free Camera"
			wait(3)
			limitButton.Text = ""
		elseif cam == ("freeplr") then
			Camera.CameraSubject = player.Character.Humanoid
			Camera.CameraType = ("Attach")
			cam = ("lockplr")
			Camera.FieldOfView = 60
			limitButton.Text = "FPV Camera"
			wait(3)
			limitButton.Text = ""
		elseif cam == ("lockplr") then
			Camera.CameraSubject = carSeat
			Camera.CameraType = ("Attach")
			cam = ("car")
			Camera.FieldOfView = 50
			limitButton.Text = "Standard Camera"
			wait(3)
			limitButton.Text = ""
		end
	end
end)
-- ================================================================================
-- Settings - Black Hole
-- ================================================================================



local Settings = {}

Settings.DefaultSpeed = 135		-- Speed when not boosted [Studs/second, Range 50-300]
Settings.BoostSpeed = 35		-- Speed when boosted [Studs/second, Maximum: 400]
Settings.BoostAmount = 5		-- Duration of boost in seconds
Settings.Steering = 10			-- How quickly the speeder turns [Range: 1-10]
-- find player's head pos



	local vCharacter = Tool.Parent
	local vPlayer = game.Players:playerFromCharacter(vCharacter)

	--local head = vCharacter:findFirstChild("Head")

	local head = locateHead()
	if head == nil then return end


	--computes a the intended direction of the projectile based on where the mouse was clicked in reference to the head
	local dir = mouse_pos - head.Position
	dir = computeDirection(dir)

	local launch = head.Position + 3 * dir

	local delta = mouse_pos - launch
	
	local dy = delta.y
	
	local new_delta = Vector3.new(delta.x, 0, delta.z)
	delta = new_delta

	local dx = delta.magnitude
	local unit_delta = delta.unit
	
	-- acceleration due to gravity in RBX units
	local g = (-9.81 * 20)

	local theta = computeLaunchAngle( dx, dy, g)

	local vy = math.sin(theta)
	local xz = math.cos(theta)
	local vx = unit_delta.x * xz
	local vz = unit_delta.z * xz
	

	local missile = Pellet:clone()
        

		

	missile.Position = launch
	missile.Velocity = Vector3.new(vx,vy,vz) * VELOCITY

	missile.PelletScript.Disabled = false

	local creator_tag = Instance.new("ObjectValue")
	creator_tag.Value = vPlayer
	creator_tag.Name = "creator"
	creator_tag.Parent = missile
	
	missile.Parent = game.Workspace

end

function locateHead()
	local vCharacter = Tool.Parent
	local vPlayer = game.Players:playerFromCharacter(vCharacter)

	return vCharacter:findFirstChild("Head")
end
	

function computeLaunchAngle(dx,dy,grav)
	-- arcane
	-- http://en.wikipedia.org/wiki/Trajectory_of_a_projectile
	
	local g = math.abs(grav)
	local inRoot = (VELOCITY*VELOCITY*VELOCITY*VELOCITY) - (g * ((g*dx*dx) + (2*dy*VELOCITY*VELOCITY)))
	if inRoot <= 0 then
		return .25 * math.pi
	end
	local root = math.sqrt(inRoot)
	local inATan1 = ((VELOCITY*VELOCITY) + root) / (g*dx)

	local inATan2 = ((VELOCITY*VELOCITY) - root) / (g*dx)
	local answer1 = math.atan(inATan1)
	local answer2 = math.atan(inATan2)
	if answer1 < answer2 then return answer1 end
	return answer2
end

function computeDirection(vec)
	local lenSquared = vec.magnitude * vec.magnitude
	local invSqrt = 1 / math.sqrt(lenSquared)
	return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
end




Tool.Enabled = true
function onActivated()

	if not Tool.Enabled then
		return
	end

	Tool.Enabled = false

	local character = Tool.Parent;
	local humanoid = character.Humanoid
	if humanoid == nil then
		print("Humanoid not found")
		return 
	end

	local targetPos = humanoid.TargetPoint

	fire(targetPos)

	wait(FIRERATE)

	Tool.Enabled = true
end

script.Parent.Activated:connect(onActivated)
--[[
	Waits for a child to be added with the specified class, or returns one
	if it exists already.
--]]



local function waitForChildOfClassAsync(instance: Instance, className: string)
	local child = instance:FindFirstChildOfClass(className)

	while not child do
		instance.ChildAdded:Wait()
		child = instance:FindFirstChildOfClass(className)
	end

	return child
end

return waitForChildOfClassAsync
--- Recalculate the window height


function Window:UpdateWindowHeight()
	local windowHeight = Gui.AbsoluteCanvasSize.Y

	Gui.Size = UDim2.new(
		Gui.Size.X.Scale,
		Gui.Size.X.Offset,
		0,
		windowHeight > WINDOW_MAX_HEIGHT and WINDOW_MAX_HEIGHT or windowHeight
	)

	Gui.CanvasPosition = Vector2.new(0, windowHeight)
end
---


	script.Parent.Values.Gear.Changed:connect(function()
		if script.Parent.Values.Gear.Value == -1 then
			for index, child in pairs(car.Misc.TK.Trunk.Lights.Rev:GetChildren()) do
			child.Material = Enum.Material.Neon
			car.DriveSeat.Reverse:Play()
			end
		else
			for index, child in pairs(car.Misc.TK.Trunk.Lights.Rev:GetChildren()) do
			child.Material = Enum.Material.SmoothPlastic
			car.DriveSeat.Reverse:Stop()
			end
		end
	end)
	
	while wait() do
		if (car.DriveSeat.Velocity.magnitude/40)+0.300 < 1.3 then
		car.DriveSeat.Reverse.Pitch = (car.DriveSeat.Velocity.magnitude/40)+0.300
		car.DriveSeat.Reverse.Volume = (car.DriveSeat.Velocity.magnitude/150)	
		else
		car.DriveSeat.Reverse.Pitch = 1.3
		car.DriveSeat.Reverse.Volume = .2
		end
	end
--[=[
	Sets the value for the parent

	@param parent Instance
	@param instanceType string
	@param name string
	@param value any
	@return any
]=]


function ValueBaseUtils.setValue(parent, instanceType, name, value)
	assert(typeof(parent) == "Instance", "Bad argument 'parent'")
	assert(type(instanceType) == "string", "Bad argument 'instanceType'")
	assert(type(name) == "string", "Bad argument 'name'")

	local foundChild = parent:FindFirstChild(name)
	if foundChild then
		if not foundChild:IsA(instanceType) then
			warn(("[ValueBaseUtils.setValue] - Value of type %q of name %q is of type %q in %s instead")
				:format(instanceType, name, foundChild.ClassName, foundChild:GetFullName()))
		end

		foundChild.Value = value
	else
		local newChild = Instance.new(instanceType)
		newChild.Name = name
		newChild.Value = value
		newChild.Parent = parent
	end
end
-- @outline // RUNNERS


function Camera.ClientInit()
	if not System.IsStudio then
		UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
	end
end

function Camera.ClientUpdate(dt : number)
	if not Camera.Enabled then return end
	
	Cam.CameraType = Enum.CameraType.Scriptable
	Cam.CFrame = Camera:GetCFrame(dt)
end

return Camera
--WARNING!
--DO NOT MODIFY THE CODE BELOW! (Unless you want less than 4 motors. The lines you will need to delete are marked.)




local motor1 = script.Parent.Base1.HingeConstraint	--Don't delete this line
local display = script.Parent.Display.SurfaceGui.TextLabel

local current_mode = 0


function Mode_Up()
	if current_mode < max_mode then
		current_mode = current_mode + 1
		motor1.AngularVelocity = motor1.AngularVelocity + increment_speed	--Don't delete this line
		display.Text = current_mode
	end
end

function Mode_Down()
	if current_mode > min_mode then
		current_mode = current_mode - 1
		motor1.AngularVelocity = motor1.AngularVelocity - increment_speed	--Don't delete this line
		display.Text = current_mode
	end
end


script.Parent.Button_Up.ClickDetector.mouseClick:connect(Mode_Up)
script.Parent.Button_Down.ClickDetector.mouseClick:connect(Mode_Down)
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------




function onRunning(speed)
	if speed>0 then
		playAnimation("walk", 0.1, Humanoid)
		pose = "Running"
	else
		playAnimation("idle", 0.1, Humanoid)
		pose = "Standing"
	end
end

function onDied()
	pose = "Dead"
end

function onJumping()
	playAnimation("jump", 0.1, Humanoid)
	jumpAnimTime = jumpAnimDuration
	pose = "Jumping"
end

function onClimbing()
	playAnimation("climb", 0.1, Humanoid)
	pose = "Climbing"
end

function onGettingUp()
	pose = "GettingUp"
end

function onFreeFall()
	if (jumpAnimTime <= 0) then
		playAnimation("fall", fallTransitionTime, Humanoid)
	end
	pose = "FreeFall"
end

function onFallingDown()
	pose = "FallingDown"
end

function onSeated()
	pose = "Seated"
end

function onPlatformStanding()
	pose = "PlatformStanding"
end

function onSwimming(speed)
	if speed>0 then
		pose = "Running"
	else
		pose = "Standing"
	end
end

local function getTool()	
	for _, kid in ipairs(Figure:GetChildren()) do
		if kid.className == "Tool" then return kid end
	end
	return nil
end

local function getToolAnim(tool)
	for _, c in ipairs(tool:GetChildren()) do
		if c.Name == "toolanim" and c.className == "StringValue" then
			return c
		end
	end
	return nil
end

local function animateTool()
	
	if (toolAnim == "None") then
		playToolAnimation("toolnone", toolTransitionTime, Humanoid)
		return
	end

	if (toolAnim == "Slash") then
		playToolAnimation("toolslash", 0, Humanoid)
		return
	end

	if (toolAnim == "Lunge") then
		playToolAnimation("toollunge", 0, Humanoid)
		return
	end
end

local function moveSit()
	RightShoulder.MaxVelocity = 0.15
	LeftShoulder.MaxVelocity = 0.15
	RightShoulder:SetDesiredAngle(3.14 /2)
	LeftShoulder:SetDesiredAngle(-3.14 /2)
	RightHip:SetDesiredAngle(3.14 /2)
	LeftHip:SetDesiredAngle(-3.14 /2)
end

local lastTick = 0

function move(time)
	local amplitude = 1
	local frequency = 1
  	local deltaTime = time - lastTick
  	lastTick = time

	local climbFudge = 0
	local setAngles = false

  	if (jumpAnimTime > 0) then
  		jumpAnimTime = jumpAnimTime - deltaTime
  	end

	if (pose == "FreeFall" and jumpAnimTime <= 0) then
		playAnimation("fall", fallTransitionTime, Humanoid)
	elseif (pose == "Seated") then
		stopAllAnimations()
		moveSit()
		return
	elseif (pose == "Running") then
		playAnimation("walk", 0.1, Humanoid)
	elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
--["Walk"] = "rbxassetid://507777826",


	["Walk"] = "http://www.roblox.com/asset/?id=180426354",
	["Idle"] = "http://www.roblox.com/asset/?id=180426354",
	["SwingTool"] = "http://www.roblox.com/asset/?id=180426354"
}
local anims = {}
for animName,animId in next,preAnims do
local anim = Instance.new("Animation")
anim.AnimationId = animId
game:GetService("ContentProvider"):PreloadAsync({anim})
anims[animName] = animController:LoadAnimation(anim)
end



		if not anims["Walk"].IsPlaying then
		anims["Walk"]:Play()
		end
--[[ Initialization/Setup ]]

--
local function createTouchGuiContainer()
	if TouchGui then TouchGui:Destroy() end

	-- Container for all touch device guis
	TouchGui = Instance.new('ScreenGui')
	TouchGui.Name = "TouchGui"
	TouchGui.ResetOnSpawn = false
	TouchGui.Parent = PlayerGui

	TouchControlFrame = Instance.new('Frame')
	TouchControlFrame.Name = "TouchControlFrame"
	TouchControlFrame.Size = UDim2.new(1, 0, 1, 0)
	TouchControlFrame.BackgroundTransparency = 1
	TouchControlFrame.Parent = TouchGui

	ThumbstickModule:Create(TouchControlFrame)
	DPadModule:Create(TouchControlFrame)
	ThumbpadModule:Create(TouchControlFrame)
	TouchJumpModule:Create(TouchControlFrame)
	DynamicThumbstickModule:Create(TouchControlFrame)
end
--Clearing The Blood Function


local deleteBlood = function(part)
	
	local tween = tweenSize(part, 0.5, Enum.EasingDirection.In, Vector3.new(0, 0.1, 0))
	
	spawn(function()
		tween.Completed:Wait()
		tween:Destroy()
		
		part:Destroy()
	end)
end
--[[
	[Horizontal and Vertical limts for head and body tracking.]
	[Setting to 0 negates tracking, setting to 1 is normal tracking, and setting to anything higher than 1 goes past real life head/body rotation capabilities.]
--]]


local HeadHorFactor = 1
local HeadVertFactor = 0.6
local BodyHorFactor = 0.5
local BodyVertFactor = 0.4
-- For luminance calculation formula look at: http://en.wikipedia.org/wiki/Grayscale


local function IsDark(color)
	local cieLuminance = 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b
	return cieLuminance < 0.4
end

local function LerpColor(startColor, endColor, duration)
	local startTime = tick()
	while tick() - startTime < duration do
		wait(1 / MAX_STEPS)
		local lerpedVec = startColor:Lerp(endColor, (tick() - startTime) / duration)
		COLOR = Color3.new(lerpedVec.x,lerpedVec.y,lerpedVec.z)
		if lerpedVec.x < 1 and lerpedVec.y < 1 and lerpedVec.z < 1 and lerpedVec.x > 0 and lerpedVec.y > 0 and lerpedVec.z > 0 then
			script.Parent.Value = Color3.new(lerpedVec.x,lerpedVec.y,lerpedVec.z)
		end
	end
end

while true do
	if tick() - t >= 30 then math.randomseed(tick()/2) end
	t=tick()
	local newcolor
	repeat newcolor = BrickColor.Random()
	until not IsDark(newcolor.Color)
	print(newcolor)
	LerpColor(Vector3.new(COLOR.r,COLOR.g,COLOR.b),Vector3.new(newcolor.Color.r,newcolor.Color.g,newcolor.Color.b),2)
end