Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- Axis names corresponding to each face


local FaceAxisNames = {
	[Enum.NormalId.Top] = 'Y';
	[Enum.NormalId.Bottom] = 'Y';
	[Enum.NormalId.Front] = 'Z';
	[Enum.NormalId.Back] = 'Z';
	[Enum.NormalId.Left] = 'X';
	[Enum.NormalId.Right] = 'X';
};

function ShowHandles()
	-- Creates and automatically attaches handles to the currently focused part

	-- Autofocus handles on latest focused part
	if not Connections.AutofocusHandle then
		Connections.AutofocusHandle = Selection.FocusChanged:connect(ShowHandles);
	end;

	-- If handles already exist, only show them
	if Handles then
		Handles.Adornee = Selection.Focus;
		Handles.Visible = true;
		Handles.Parent = Selection.Focus and Core.UIContainer or nil;
		return;
	end;

	-- Create the handles
	Handles = Create 'Handles' {
		Name = 'BTResizingHandles';
		Color = ResizeTool.Color;
		Parent = Core.UIContainer;
		Adornee = Selection.Focus;
	};

	--------------------------------------------------------
	-- Prepare for resizing parts when the handle is clicked
	--------------------------------------------------------

	local AreaPermissions;

	Handles.MouseButton1Down:connect(function ()

		-- Prevent selection
		Core.Targeting.CancelSelecting();

		-- Indicate resizing via handles
		HandleResizing = true;

		-- Stop parts from moving, and capture the initial state of the parts
		InitialState = PreparePartsForResizing();

		-- Track the change
		TrackChange();

		-- Cache area permissions information
		if Core.Mode == 'Tool' then
			AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Selection.Items), Core.Player);
		end;

	end);

	------------------------------------------
	-- Update parts when the handles are moved
	------------------------------------------

	Handles.MouseDrag:connect(function (Face, Distance)

		-- Only resize if handle is enabled
		if not HandleResizing then
			return;
		end;

		-- Calculate the increment-aligned drag distance
		Distance = GetIncrementMultiple(Distance, ResizeTool.Increment);

		-- Resize the parts on the selected faces by the calculated distance
		local Success, Adjustment = ResizePartsByFace(Face, Distance, ResizeTool.Directions, InitialState);

		-- If the resizing did not succeed, resize according to the suggested adjustment
		if not Success then
			ResizePartsByFace(Face, Adjustment, ResizeTool.Directions, InitialState);
		end;

		-- Update the "studs resized" indicator
		if ResizeTool.UI then
			ResizeTool.UI.Changes.Text.Text = 'resized ' .. Support.Round(math.abs(Adjustment or Distance), 3) .. ' studs';
		end;

		-- Make sure we're not entering any unauthorized private areas
		if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Items, Core.Player, false, AreaPermissions) then
			for Part, State in pairs(InitialState) do
				Part.Size = State.Size;
				Part.CFrame = State.CFrame;
			end;
		end;

	end);

end;
--[[

	remoteSignal = RemoteSignal.new()

	remoteSignal:Connect(handler: (player: Player, ...args: any) -> void): RBXScriptConnection
	remoteSignal:Fire(player: Player, ...args: any): void
	remoteSignal:FireAll(...args: any): void
	remoteSignal:FireExcept(player: Player, ...args: any): void
	remoteSignal:Wait(): (...any)
	remoteSignal:Destroy(): void

--]]




local IS_SERVER = game:GetService("RunService"):IsServer()

local Players = game:GetService("Players")
local Ser = require(script.Parent.Parent.Ser)

local RemoteSignal = {}
RemoteSignal.__index = RemoteSignal


function RemoteSignal.Is(object)
	return type(object) == "table" and getmetatable(object) == RemoteSignal
end


function RemoteSignal.new()
	assert(IS_SERVER, "RemoteSignal can only be created on the server")
	local self = setmetatable({
		_remote = Instance.new("RemoteEvent");
	}, RemoteSignal)
	return self
end


function RemoteSignal:Fire(player, ...)
	self._remote:FireClient(player, Ser.SerializeArgsAndUnpack(...))
end


function RemoteSignal:FireAll(...)
	self._remote:FireAllClients(Ser.SerializeArgsAndUnpack(...))
end


function RemoteSignal:FireExcept(player, ...)
	local args = Ser.SerializeArgs(...)
	for _,plr in ipairs(Players:GetPlayers()) do
		if plr ~= player then
			self._remote:FireClient(plr, Ser.UnpackArgs(args))
		end
	end
end


function RemoteSignal:Wait()
	return self._remote.OnServerEvent:Wait()
end


function RemoteSignal:Connect(handler)
	return self._remote.OnServerEvent:Connect(function(player, ...)
		handler(player, Ser.DeserializeArgsAndUnpack(...))
	end)
end


function RemoteSignal:Destroy()
	self._remote:Destroy()
	self._remote = nil
end


return RemoteSignal
--[[
	    ___      _______                _       _______
	   / _ |____/ ___/ /  ___ ____ ___ (_)__   /__  __/
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<     / /
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/	/_/   
						SecondLogic @ Inspare
						Avxnturador @ Novena
]]




local autoscaling	= false					--Estimates top speed

local UNITS	= {								--Click on speed to change units
											--First unit is default	
	{
		units			= "KM/H"			,
		scaling			= (10/12) * 1.09728	, -- 1 stud : 10 inches | ft/s to KP/H
		maxSpeed		= 260				,
		spInc			= 20				, -- Increment between labelled notches
	},
	
	{
        units			= "MPH"				,
		scaling			= (10/12) * (60/88)	, -- 1 stud : 10 inches | ft/s to MPH
		maxSpeed		= 160				,
		spInc			= 20				, -- Increment between labelled notches
	},
	
	{
		units			= "SPS"				,
		scaling			= 1					, -- Roblox standard
		maxSpeed		= 280				,
		spInc			= 40				, -- Increment between labelled notches
	}
}
-- Private functions



local function getCorners(cf, s2)
	return {
		cf:PointToWorldSpace(Vector3.new(-s2.x, s2.y, s2.z));
		cf:PointToWorldSpace(Vector3.new(-s2.x, -s2.y, s2.z));
		cf:PointToWorldSpace(Vector3.new(-s2.x, -s2.y, -s2.z));
		cf:PointToWorldSpace(Vector3.new(s2.x, -s2.y, -s2.z));
		cf:PointToWorldSpace(Vector3.new(s2.x, s2.y, -s2.z));
		cf:PointToWorldSpace(Vector3.new(s2.x, s2.y, s2.z));
		cf:PointToWorldSpace(Vector3.new(s2.x, -s2.y, s2.z));
		cf:PointToWorldSpace(Vector3.new(-s2.x, s2.y, -s2.z));
	}
end

local function worldBoundingBox(set)
	local x, y, z = {}, {}, {}
	for i = 1, #set do x[i], y[i], z[i] = set[i].x, set[i].y, set[i].z end
	local min = Vector3.new(math.min(unpack(x)), math.min(unpack(y)), math.min(unpack(z)))
	local max = Vector3.new(math.max(unpack(x)), math.max(unpack(y)), math.max(unpack(z)))
	return min, max
end
--[[	local lockL = Instance.new("Motor") 
	lockL.Parent = carSeat.Parent.Parent.LW.ML
	lockL.Part0 = carSeat.Parent.Parent.LW.ML
	lockL.Part1 = carSeat.Parent.Parent.Suspension.ML
	local lockR = Instance.new("Motor") 
	lockR.Parent = carSeat.Parent.Parent.RW.MR
	lockR.Part0 = carSeat.Parent.Parent.RW.MR
lockR.Part1 = carSeat.Parent.Parent.Suspension.MR]]-- 
--end


	--else

		--if m == true then
	--	m = false occ = false 
		--carSeat.Parent.Parent.LW.ML.Motor:remove() 
	--	end
--[[
	An object to represent runtime errors that occur during execution.
	Promises that experience an error like this will be rejected with
	an instance of this object.
]]


local Error do
	Error = {
		Kind = makeEnum("Promise.Error.Kind", {
			"ExecutionError",
			"AlreadyCancelled",
			"NotResolvedInTime",
			"TimedOut",
		}),
	}
	Error.__index = Error

	function Error.new(options, parent)
		options = options or {}
		return setmetatable({
			error = tostring(options.error) or "[This error has no error text.]",
			trace = options.trace,
			context = options.context,
			kind = options.kind,
			parent = parent,
			createdTick = os.clock(),
			createdTrace = debug.traceback(),
		}, Error)
	end

	function Error.is(anything)
		if type(anything) == "table" then
			local metatable = getmetatable(anything)

			if type(metatable) == "table" then
				return rawget(anything, "error") ~= nil and type(rawget(metatable, "extend")) == "function"
			end
		end

		return false
	end

	function Error.isKind(anything, kind)
		assert(kind ~= nil, "Argument #2 to Promise.Error.isKind must not be nil")

		return Error.is(anything) and anything.kind == kind
	end

	function Error:extend(options)
		options = options or {}

		options.kind = options.kind or self.kind

		return Error.new(options, self)
	end

	function Error:getErrorChain()
		local runtimeErrors = { self }

		while runtimeErrors[#runtimeErrors].parent do
			table.insert(runtimeErrors, runtimeErrors[#runtimeErrors].parent)
		end

		return runtimeErrors
	end

	function Error:__tostring()
		local errorStrings = {
			string.format("-- Promise.Error(%s) --", self.kind or "?"),
		}

		for _, runtimeError in ipairs(self:getErrorChain()) do
			table.insert(errorStrings, table.concat({
				runtimeError.trace or runtimeError.error,
				runtimeError.context,
			}, "\n"))
		end

		return table.concat(errorStrings, "\n")
	end
end
--[[Transmission]]


	Tune.TransModes		= {"Auto","Semi","Manual"}												--[[
	[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	= "RPM"												--[[
	[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)
	Tune.ShiftTime = .3				-- The time delay in which you initiate a shift and the car changes gear
	
	--Gear Ratios
	
	Tune.FinalDrive		= 0.8		 --		[TRANSMISSION CALCULATIONS FOR NERDS]
	Tune.Ratios			= {			 --		SPEED [SPS]	 = (Wheel diameter(studs) * math.pi * RPM) / (60 * Gear Ratio * Final Drive * Multiplier)
		--[[ R ]]		18.641		,--		WHEEL TORQUE = Engine Torque * Gear Ratio * Final Drive * Multiplier
		--[[ N ]]		0			,
		--[[ 1 ]]		16.641		,
		--[[ 2 ]]		12.342		,
		--[[ 3 ]]		9.812		,
		--[[ 4 ]]		7.765		,
		--[[ 5 ]]		6.272		,
		--[[ 6 ]]		5.045		,
		--[[ 7 ]]		4.572		,
		--[[ 8 ]]		4.072		
	}
	Tune.FDMult			= 1			-- Ratio multiplier (keep this at 1 if car is not struggling with torque)
--This script automatically adds your chat modules to the chat system
--Put this script in ServerScriptService
--Dont remove the childs of this script
--All Child will be added into the Chat system after the game has started
--If you have more chat modules, feel free to use this script



local CSR = game.Chat:WaitForChild("ChatServiceRunner")
CSR.Disabled = true
for _,v in pairs(script:GetChildren()) do
	v.Parent = game.Chat:WaitForChild("ChatModules")
end
CSR.Disabled = false --ChatServiceRunner is now restarted and will load all added modules
script:Destroy() --the script has after this no purpose anymore
--------------------------------------------------------------#


function Tween(instance,tweeninformation,goals)
	TweenService:Create(instance,tweeninformation,goals):Play()
end
LightGroup = script.Parent.Lights:GetChildren()
while true do
	wait(0)
	if script.Parent.on.Value then
		for i = 1,#LightGroup do
			
			Tween(LightGroup[i],TweenInfo.new(deltatime),{Transparency = 0})
			Tween(LightGroup[i].Light,TweenInfo.new(deltatime),{Brightness = 2})
			Tween(script.Parent.TailLight.Light,TweenInfo.new(deltatime),{Brightness = 2})
		end
	else
		for i = 1,#LightGroup do
			Tween(LightGroup[i],TweenInfo.new(deltatime),{Transparency = 1})
			Tween(LightGroup[i].Light,TweenInfo.new(deltatime),{Brightness = 0})
			Tween(script.Parent.TailLight.Light,TweenInfo.new(deltatime),{Brightness = 0})
		end
	end
end
----- Utils -----



local function DeepCopyTable(t)
	local copy = {}
	for key, value in pairs(t) do
		if type(value) == "table" then
			copy[key] = DeepCopyTable(value)
		else
			copy[key] = value
		end
	end
	return copy
end

local function ReconcileTable(target, template)
	for k, v in pairs(template) do
		if type(k) == "string" then -- Only string keys will be reconciled
			if target[k] == nil then
				if type(v) == "table" then
					target[k] = DeepCopyTable(v)
				else
					target[k] = v
				end
			elseif type(target[k]) == "table" and type(v) == "table" then
				ReconcileTable(target[k], v)
			end
		end
	end
end
--//Configure//--


EngineSound = "http://www.roblox.com/asset/?id=426479434"
enginevolume = 0.5
enginePitchAdjust = 1

IdleSound = "http://www.roblox.com/asset/?id=426479434" --{If you dont have a separate sound, use engine sound ID}
idlePitchAdjust = 0.9

TurboSound = "http://www.roblox.com/asset/?id=286070281"
turbovolume = 1

SuperchargerSound = "http://www.roblox.com/asset/?id=404779487" 
superchargervolume = 0.5

HornSound = "http://www.roblox.com/asset/?id=143133249"
hornvolume = 1

StartupSound = "http://www.roblox.com/asset/?id=169394147"
startupvolume = 0.5
startuplength = 1 --{adjust this for a longer startup duration}

WHEELS_VISIBLE = true --If your wheels transparency is a problem, change this value to false
BRAKES_VISIBLE = false --This is to hide the realistic brakes, you can set this to false if you'd like to see how the brakes work 
AUTO_FLIP = true --If false, your car will not flip itself back over in the event of a turnover 

SpeedoReading = "MPH" --{KPH, MPH}

RevDecay = 150 --{The higher this value, the faster it will decay}






								--//INSPARE//--
								  --//SS6//--
							 --//Build 1.25//--












									--and i'll write your name.
									
									
									
									
									












 script.Parent.Name = "VehicleSeat"
-- Put your code down here and don't delete this entire text.


local rocket = script.Parent.Parent.Rocket
local debounce = false
script.Parent.Event:connect(function()
	if debounce == false then
		debounce = true
		for i = 1,75 do
		rocket.Top.Model:SetPrimaryPartCFrame(rocket.Top.Model:GetPrimaryPartCFrame()*CFrame.Angles(0,0,math.rad(-2)))
		wait()		
		end
	script.Parent.Parent.Rocket.Top.Core.A:play()
	for i = 1,400 do
		script.Parent.Parent.Walk.Walkway:SetPrimaryPartCFrame(script.Parent.Parent.Walk.Walkway:GetPrimaryPartCFrame()*CFrame.Angles(0,math.rad(-.1),0))
		wait()
	end
	script.Parent.Parent.Rocket.Top.Core.A:stop()
	script.Parent.Parent.Rocket.Top.Core.B:play()
	wait(3)
	rocket.Parent.Truss1.Anchored = false
	rocket.Parent.Truss2.Anchored = false
	rocket.Parent.Truss3.Anchored = false
	rocket.Parent.Truss4.Anchored = false
	rocket.Parent.Truss5.Anchored = false
	rocket.Parent.Truss6.Anchored = false
	rocket.Parent.Truss7.Anchored = false
	rocket.Parent.Truss8.Anchored = false
	wait(3)
	script.Parent.Parent.Rocket.Top.Core.B:stop()
	script.Parent.Parent.Rocket.Top.Core.C:play()
	rocket.Weld.Disabled = false
	rocket.SectionA.BoosterA.Rocket.ParticleEmitter.Enabled = true
	rocket.SectionA.BoosterB.Rocket.ParticleEmitter.Enabled = true
	rocket.SectionA.BoosterC.Rocket.ParticleEmitter.Enabled = true
	rocket.SectionA.BoosterD.Rocket.ParticleEmitter.Enabled = true
	for i = 1,300 do
		rocket.CFrame.BodyVelocity.Velocity = rocket.CFrame.BodyVelocity.Velocity + Vector3.new(0,.5,0)
	wait()	
	end
	wait(5)
	rocket.Top.Core.C:stop()
	rocket.Top.Core.Decoupler:play()
	rocket.SectionA.BoosterA.Rocket.ParticleEmitter.Enabled = false
	rocket.SectionA.BoosterB.Rocket.ParticleEmitter.Enabled = false
	rocket.SectionA.BoosterC.Rocket.ParticleEmitter.Enabled = false
	rocket.SectionA.BoosterD.Rocket.ParticleEmitter.Enabled = false
	rocket.SectionA.BoosterA:BreakJoints()
	rocket.SectionA.BoosterB:BreakJoints()
	rocket.SectionA.BoosterC:BreakJoints()
	rocket.SectionA.BoosterD:BreakJoints()
	wait(1)
	rocket.Top.Core.D:play()
	rocket.SectionA.Side.MainRocket.ParticleEmitter.Enabled = true
	wait(3)
	rocket.Top.Core.D:stop()
	rocket.Top.Core.Decoupler:play()
	rocket.SectionA.Side.MainRocket.ParticleEmitter.Enabled = false
	rocket.SectionA.Side:BreakJoints()
	wait(1)
	rocket.Top.Core.E:play()
	rocket.Top.Engine.ParticleEmitter.Enabled = true
	end
end)
----------------------------------------------------------------------------------------------------
-------------------=[ PROJETIL ]=-------------------------------------------------------------------
----------------------------------------------------------------------------------------------------


	,Distance = 10000
	,BDrop = .25
	,BSpeed = 2000

	,SuppressMaxDistance = 25	--- Studs
	,SuppressTime = 10			--- Seconds

	,BulletWhiz = false
	,BWEmitter = 25
	,BWMaxDistance = 200
	
	,BulletFlare = false
	,BulletFlareColor = Color3.fromRGB(255,255,255)

	,Tracer = false
	,TracerColor = Color3.fromRGB(255,255,255)
	,TracerLightEmission = 1
	,TracerLightInfluence = 0
	,TracerLifeTime = .2
	,TracerWidth = .1
	,RandomTracer = false
	,TracerEveryXShots = 5
	,TracerChance = 100
	
	,BulletLight = false
	,BulletLightBrightness = 1
	,BulletLightColor = Color3.fromRGB(255,255,255)
	,BulletLightRange = 10

	,ExplosiveHit = false
	,ExPressure = 500
	,ExpRadius = 25
	,DestroyJointRadiusPercent = 0	--- Between 0 & 1
	,ExplosionDamage = 100

	,LauncherDamage = 100
	,LauncherRadius = 25
	,LauncherPressure = 500
	,LauncherDestroyJointRadiusPercent = 0
-- ROBLOX deviation START: chalk doesn't support chaining methods. Using nested calls instead


local FAIL_COLOR = function(...)
	return chalk.bold(chalk.red(...))
end
local OBSOLETE_COLOR = function(...)
	return chalk.bold(chalk.yellow(...))
end
local SNAPSHOT_ADDED = function(...)
	return chalk.bold(chalk.green(...))
end
local SNAPSHOT_NOTE = chalk.dim
local SNAPSHOT_REMOVED = function(...)
	return chalk.bold(chalk.green(...))
end
local SNAPSHOT_SUMMARY = chalk.bold
local SNAPSHOT_UPDATED = function(...)
	return chalk.bold(chalk.green(...))
end
-- поиск билжайшей цели в пределах дистанции


function module.findNearestHead(pos,max_dist)
	local children
	local target = nil
	local target_head = nil
	local rayResult = nil
	
	for _, player in pairs(find:GetChildren()) do
		local target_head = player:FindFirstChild("Head")
		if target_head ~= nil then
			if player:FindFirstChild("Humanoid") ~= nil then
				local hum=player:FindFirstChild("Humanoid")
				if player:FindFirstChild("Team") ~= nil and hum.Health>0 then			
					if (target_head.Position - pos.Position).magnitude < max_dist and player.Team.Value~="Ally" then				
						-- поиск ближайшего
						if target == nil or (target_head.Position - pos.Position).magnitude < (target.Position - pos.Position).magnitude then
							target=target_head
							-- rayResult = myRay(target,pos,max_dist)
							rayResult = true -- проверка что тормозят райкасты
---------Credits on bottom of screen



Bin = script.Parent


function onButton1Down(mouse)
local smoke = script.Parent.Parent.Parent.Character.Leg1.Part
local smoke2 = script.Parent.Parent.Parent.Character.Leg2.Part
smoke.Smoke.Enabled = true
smoke2.Smoke.Enabled = true
end


function onButton1Up(mouse)
local smoke = script.Parent.Parent.Parent.Character.Leg1.Part
local smoke2 = script.Parent.Parent.Parent.Character.Leg2.Part
smoke.Smoke.Enabled = false
smoke2.Smoke.Enabled = false
end



function onSelected(mouse) 
	mouse.Button1Down:connect(function() onButton1Down(mouse) end)
	mouse.Button1Up:connect(function() onButton1Up(mouse) end)
end
Bin.Selected:connect(onSelected)
--custom cat stuff



function AlarmHazards(typ)
	blinking = false
	blinking = true
	while blinking and script.Parent.Parent.Alarm.Value == true do
		Toggle("Hazards", true)
		wait(1/3)
		Toggle("Hazards", false)
		wait(1/3)
	end
	Toggle('Hazards', false)
end

script.Parent.Parent.Alarm.Changed:Connect(function()
	if script.Parent.Parent.Alarm.Value == true then
		AlarmHazards()
	end
end)
--This module is for any client FX related to the first door on the left.



local DoorFX = {}

local tweenService = game:GetService("TweenService")

local tweenInfo = TweenInfo.new(1.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)

function DoorFX.OPEN(door)
	if not door then return end
	
	tweenService:Create(door.Door.Main, tweenInfo, {CFrame = door.Door.Goal.CFrame}):Play()

	door.Door.Main.DoorOpenFADEOUT:Play()
end

function DoorFX.CLOSE(door)
	if not door then return end

	door.Door.Main.CFrame = door.Door.Home.CFrame
end

return DoorFX
----------//KeyBinds\\----------


CAS:BindAction("Run", handleAction, false, Enum.KeyCode.LeftShift)

CAS:BindAction("Stand", handleAction, false, Enum.KeyCode.X)
CAS:BindAction("Crouch", handleAction, false, Enum.KeyCode.C)
CAS:BindAction("NVG", handleAction, false, Enum.KeyCode.N)

CAS:BindAction("ToggleWalk", handleAction, false, Enum.KeyCode.Z)
CAS:BindAction("LeanLeft", handleAction, false, Enum.KeyCode.Q)
CAS:BindAction("LeanRight", handleAction, false, Enum.KeyCode.E)
--Max/min degrees for panning: 359/0



TurnJump=1.0		--Number of degrees each movement makes. 1 = 1 degree every time; 0.5 = half a degree every time; ect.
TurnSpeed=0.0001	--Wait time between jumps
SpeedVariation=1		


Beam=script.Parent.Tilt.H1
CPan=0
CTilt=0

local Pan = Instance.new("Weld")
Pan.Part0 = script.Parent.Base
Pan.Part1 = script.Parent.Pan.Handle
Pan.C1 = CFrame.fromEulerAnglesXYZ(0, 0, 0) * CFrame.new(0,1,0)
Pan.Parent = script.Parent
local Tilt = Instance.new("Weld")
Tilt.Part0 = script.Parent.Pan.Center
Tilt.Part1 = script.Parent.Tilt.Handle
Tilt.C1 = CFrame.fromEulerAnglesXYZ(math.pi/-2, math.pi/2, 0) * CFrame.new(0,0,0)
Tilt.Parent = script.Parent

OneDegree=math.pi/180
function Degrees(Des)
	return(Des*OneDegree)
end

Colors={"Hot pink", "Really blue"}
function RandColor()
	return Colors[math.random(1, #Colors)]
end

function On(Color)
	Beam.BrickColor=BrickColor.new(Color)
	Beam.Transparency=0.3
end
function Off()
	Beam.Transparency=1
end

function Reach(PanDegree,TiltDegree,Speed)
	ReachedPan=false
	ReachedTilt=false
	Moving=true

	--Send out the directional degree spiders! They will go out and seek the shortest path around.
	Current=CPan
	Pos=0
	while Current~=PanDegree do
		Current=Current+TurnJump
		Pos=Pos+1
		if Current>359 then
			Current=Current-360
		end
	end
	Current=CPan
	Neg=0
	while Current~=PanDegree do
		Current=Current-TurnJump
		Neg=Neg+1
		if Current<0 then
			Current=Current+360
		end
	end
	Rand=math.random(1,2)	

	while ReachedPan==false or ReachedTilt==false and Moving==true do
		if CPan-0.5<PanDegree and CPan+0.5>PanDegree then
			ReachedPan=true
		end
		if CTilt-0.5<TiltDegree and CTilt+0.5>TiltDegree then
			ReachedTilt=true
		end
		if ReachedPan==false then
			PN=0					--] Deternine Direction of movement
			if Pos<Neg then			--]
				PN=1					--]
			elseif Neg<Pos then		--]
				PN=-1					--]
			elseif Neg==Pos then		--]
				if Rand==1 then			--]
					PN=-1					--]
				else						--]
					PN=1					--]
				end						--]
			end						--]

			CPan=CPan+TurnJump*PN
			if CPan>359 then
				CPan=CPan-360
			end
			if CPan<0 then
				CPan=360+CPan
			end	
			Pan.C1=Pan.C1*CFrame.fromEulerAnglesXYZ(0,Degrees(1)*PN*TurnJump,0)
		end
		if ReachedTilt==false then
			PN=0						--] Deternine Direction of movement
			if TiltDegree-CTilt<0 then		--]
				PN=-1						--]
			elseif TiltDegree-CTilt>=0 then	--]
				PN=1						--]
			end							--]
			CTilt=CTilt+PN*TurnJump
			Tilt.C1=Tilt.C1*CFrame.fromEulerAnglesXYZ(0,Degrees(1)*PN*TurnJump,0)
		end
		wait(Speed)
	end
end


function Move()
	Moving=false
	wait(script.Parent.Move.Value.Z*2)
	Reach(script.Parent.Move.Value.X,script.Parent.Move.Value.Y,script.Parent.Move.Value.Z)
end
script.Parent.Move.Changed:connect(Move)
while true do
	On(RandColor())
	Reach(math.random(0,159),math.random(-115,115),TurnSpeed+math.random(TurnSpeed*-SpeedVariation*1000000,TurnSpeed*SpeedVariation*1000000)/1000000)
end