Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- Given element.props.children, or subtree during recursive traversal,
-- return flattened array of children.


local function getChildren(arg: unknown, children_: Array<unknown>?)
	local children = children_ or {}
	if Array.isArray(arg) then
		Array.forEach(arg :: Array<unknown>, function(item)
			getChildren(item, children)
		end)
	elseif arg ~= nil and arg ~= false then
		table.insert(children, arg)
	end
	return children
end

local function getType(element: any)
	local type_ = element.type
	if typeof(type_) == "string" then
		return type_
	end
	-- ROBLOX deviation START: functions can't have properties in Lua
	if typeof(type_) == "function" then
		local typeName = debug.info(type_, "n")
		return if Boolean.toJSBoolean(typeName) then typeName else "Unknown"
	end
	if typeof(type_) == "table" then
		local metatable = getmetatable(type_)
		if metatable ~= nil and typeof(metatable.__call) == "function" then
			return if Boolean.toJSBoolean(type_.displayName)
				then type_.displayName
				elseif Boolean.toJSBoolean(type_.name) then type_.name
				else "Unknown"
		end
	end
	-- ROBLOX deviation END

	if ReactIs.isFragment(element) then
		return "React.Fragment"
	end
	if ReactIs.isSuspense(element) then
		return "React.Suspense"
	end
	if typeof(type_) == "table" and type_ ~= nil then
		if ReactIs.isContextProvider(element) then
			return "Context.Provider"
		end
		if ReactIs.isContextConsumer(element) then
			return "Context.Consumer"
		end

		if ReactIs.isForwardRef(element) then
			if Boolean.toJSBoolean(type_.displayName) then
				return type_.displayName
			end

			-- ROBLOX deviation START: check if type_.render is callable table
			local functionName = if typeof(type_.render) == "function"
					and Boolean.toJSBoolean(debug.info(type_.render, "n"))
				then debug.info(type_.render, "n")
				else if typeof(type_.render) == "table"
					then if Boolean.toJSBoolean(type_.render.displayName)
						then type_.render.displayName
						elseif Boolean.toJSBoolean(type_.render.name) then type_.render.name
						else ""
					else ""
			-- ROBLOX deviation END

			return if functionName ~= "" then "ForwardRef(" .. functionName .. ")" else "ForwardRef"
		end

		if ReactIs.isMemo(element) then
			local functionName = if Boolean.toJSBoolean(type_.displayName)
				then type_.displayName
				elseif
					typeof(type_.type) == "table" -- ROBLOX deviation: can't index functions in Lua
					and Boolean.toJSBoolean(type_.type.displayName)
				then type_.type.displayName
				elseif typeof(type_.type) == "function" and Boolean.toJSBoolean(debug.info(type_.type, "n")) then
					debug.info(type_.type, "n")
				else ""

			return if functionName ~= "" then "Memo(" .. functionName .. ")" else "Memo"
		end
	end
	return "UNDEFINED"
end

local function getPropKeys(element: any)
	local props = element.props

	return Array.sort(Array.filter(Object.keys(props), function(key)
		return key ~= "children" and props[key] ~= nil
	end))
end
---- Script: -----



Event.OnServerEvent:Connect(function(player, Skin)
	
	local PlayerInventory = player.Inventory
	
	--Skin 1 de la caja
	if Skin == 1 then
		player.Inventory.Asphalt.Quantity.Value += 1
	elseif Skin == 2 then
		player.Inventory.Camo.Quantity.Value += 1
	elseif Skin == 3 then
		player.Inventory.Lime.Quantity.Value += 1
	elseif Skin == 4 then
		player.Inventory.Maple.Quantity.Value += 1
	elseif Skin == 5 then
		player.Inventory.Candy.Quantity.Value += 1
	elseif Skin == 6 then
		player.Inventory.Cardboard.Quantity.Value += 1
	elseif Skin == 7 then
		player.Inventory.WhiteOut.Quantity.Value += 1
	elseif Skin == 8  then
		player.Inventory.Scales.Quantity.Value += 1
	elseif Skin == 9 then
		player.Inventory.Matrix.Quantity.Value += 1
	elseif Skin == 10 then
		player.Inventory.Printstream.Quantity.Value += 1
	end
end)
-- Calls fn(...) in a separate thread and returns false if it errors or invoking client leaves the game.
-- Fail state is only checked every 0.5 seconds, so don't expect errors to return immediately


function SafeInvokeCallback(handler, ...)
	local finished = false
	local callbackThread
	local invokeThread
	local result
	
	local function finish(...)
		if not finished then
			finished = true
			result = table.pack(...)
			
			if invokeThread then
				ResumeThread(invokeThread)
			end
		end
	end
	
	FastSpawn(function(...)
		callbackThread = coroutine.running()
		finish(true, handler.Callback(...))
	end, ...)
	
	if not finished then
		local client = IsServer and (...)
		
		coroutine.wrap(function()
			while not finished and coroutine.status(callbackThread) ~= "dead" do
				if IsServer and client.Parent ~= Players then
					break
				end
				
				wait(0.5)
			end
			
			finish(false)
		end)()
	end
	
	if not finished then
		invokeThread = coroutine.running()
		YieldThread()
	end
	
	return unpack(result)
end

function SafeInvoke(timeout, handler, ...)
	local thread = coroutine.running()
	local finished = false
	local result

	coroutine.wrap(function(...)
		if IsServer then
			result = table.pack(pcall(function(...) return handler.Remote:InvokeClient(...) end, ...))
		else
			result = table.pack(pcall(function(...) return handler.Remote:InvokeServer(...) end, ...))
		end

		if not finished then
			finished = true
			ResumeThread(thread)
		end
	end)(...)
	
	if typeof(timeout) == "number" then
		delay(timeout, function()
			if not finished then
				finished = true
				ResumeThread(thread)
			end
		end)
	end

	YieldThread()

	if result and result[1] == true and result[2] == true then
		return true, unpack(result, 3)
	end

	return false
end

function SafeFireEvent(handler, ...)
	local callbacks = handler.Callbacks
	local index = #callbacks
	
	while index > 0 do
		local running = true
		
		FastSpawn(function(...)
			while running and index > 0 do
				local fn = callbacks[index]
				index -= 1
				
				fn(...)
			end
		end, ...)
		
		running = false
	end
end
--Disable script if car is removed from workspace


Car.AncestryChanged:Connect(function()
	if not Car:IsDescendantOf(Workspace) then
		unbindActions()
		
		LocalVehicleSeating.ExitSeat()
		LocalVehicleSeating.DisconnectFromSeatExitEvent(onExitSeat)
		-- stop seated anim
		print("car removed from workspace")
		
		script.Disabled = true
	end
end)

local function getInputValue(keyInfo, inputObj)
	for _, keyCodeInfo in ipairs(keyInfo) do
		if inputObj.KeyCode == keyCodeInfo.KeyCode then
			if keyCodeInfo.Axis then
				local inputVector = inputObj.Position * keyCodeInfo.Axis
				local sign = math.sign(inputVector.X + inputVector.Y + inputVector.Z)
				return inputVector.magnitude * sign
			else
				return 1
			end
		end
	end
	return 0
end

local function exitVehicle(action, inputState, inputObj)
	if inputState == Enum.UserInputState.Begin then
		LocalVehicleSeating.ExitSeat()
		-- stop seated anim
	end
end

ContextActionService:BindAction(
	EXIT_ACTION_NAME,
	exitVehicle,
	false,
	Keymap.EnterVehicleGamepad,
	Keymap.EnterVehicleKeyboard
)

local function steerLeftAction(action, inputState, inputObj)
	if inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Change then
		SteerLeftValue = getInputValue(Keymap.SteerLeft, inputObj)
	else
		SteerLeftValue = 0
	end
	return Enum.ContextActionResult.Pass
end

ContextActionService:BindActionAtPriority(
	STEER_LEFT_ACTION_NAME,
	steerLeftAction,
	false,
	Enum.ContextActionPriority.High.Value,
	unpack(Keymap.KeysForAction("SteerLeft"))
)

local function steerRightAction(action, inputState, inputObj)
	if inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Change then
		SteerRightValue = getInputValue(Keymap.SteerRight, inputObj)
	else
		SteerRightValue = 0
	end
	return Enum.ContextActionResult.Pass
end

ContextActionService:BindActionAtPriority(
	STEER_RIGHT_ACTION_NAME,
	steerRightAction,
	false,
	Enum.ContextActionPriority.High.Value,
	unpack(Keymap.KeysForAction("SteerRight"))
)

local function throttleAction(action, inputState, inputObj)
	if inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Change then
		ThrottleValue = getInputValue(Keymap.Throttle, inputObj)
	else
		ThrottleValue = 0
	end
end

ContextActionService:BindAction(
	THROTTLE_ACTION_NAME,
	throttleAction,
	false,
	unpack(Keymap.KeysForAction("Throttle"))
)

local function brakeAction(action, inputState, inputObj)
	if inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Change then
		BrakeValue = getInputValue(Keymap.Brake, inputObj)
	else
		BrakeValue = 0
	end
end

ContextActionService:BindAction(
	BRAKE_ACTION_NAME,
	brakeAction,
	false,
	unpack(Keymap.KeysForAction("Brake"))
)

local function handBrakeAction(action, inputState, inputObj)
	if inputState == Enum.UserInputState.Begin then
		HandBrakeValue = 1
	else
		HandBrakeValue = 0
	end
end

ContextActionService:BindAction(
	HAND_BRAKE_ACTION_NAME,
	handBrakeAction,
	false,
	unpack(Keymap.KeysForAction("Handbrake"))
)
--// Recoil Settings	


	gunrecoil = -0.75; -- How much the gun recoils backwards when not aiming
	camrecoil = 1.06; -- How much the camera flicks when not aiming
	AimGunRecoil = -0.75; -- How much the gun recoils backwards when aiming
	AimCamRecoil = 0.83; -- How much the camera flicks when aiming
	
	CamShake = 7; -- THIS IS NEW!!!! CONTROLS CAMERA SHAKE WHEN FIRING
	AimCamShake = 5; -- THIS IS ALSO NEW!!!!
	
	Kickback = 12.2; -- Upward gun rotation when not aiming
	AimKickback = 9.11; -- Upward gun rotation when aiming
------------------------------------------------------------------------
--
-- * used in (lparser) luaY:whilestat(), luaY:repeatstat(), luaY:forbody()
------------------------------------------------------------------------


function luaK:patchlist(fs, list, target)
  if target == fs.pc then
    self:patchtohere(fs, list)
  else
    assert(target < fs.pc)
    self:patchlistaux(fs, list, target, luaP.NO_REG, target)
  end
end
--[[ Constants ]]

--
local DPAD_SHEET = "rbxasset://textures/ui/DPadSheet.png"
local TOUCH_CONTROL_SHEET = "rbxasset://textures/ui/TouchControlsSheet.png"
local ZERO_VECTOR3 = Vector3.new(0,0,0)
local UNIT_Z = Vector3.new(0,0,1)
local UNIT_X = Vector3.new(1,0,0)
-- setup emote chat hook


game:GetService("Players").LocalPlayer.Chatted:Connect(function(msg)
	local emote = ""
	if msg == "/e dance" then
		emote = dances[math.random(1, #dances)]
	elseif (string.sub(msg, 1, 3) == "/e ") then
		emote = string.sub(msg, 4)
	elseif (string.sub(msg, 1, 7) == "/emote ") then
		emote = string.sub(msg, 8)
	end
	
	if (pose == "Standing" and emoteNames[emote] ~= nil) then
		playAnimation(emote, 0.1, Humanoid)
	end

end)
--[[
	Check if all humanoids has completed animation for hiding/showing.
]]


modules.waitForHumanoidAnimations = function(self)
	return function()
		for _, humanoidController in pairs(self.humanoidControllers) do
			if humanoidController:isAnimating() then
				humanoidController.animationCompleted.Event:Wait()
			end
		end
	end
end

modules.getModelFace = function()
	return function(model)
		local face = model:GetAttribute(constants.Attributes.SurfaceCanvasFace)
		if not face then
			return Enum.NormalId.Front
		end

		-- Case insensitive to make it more user friendly
		face = string.lower(face)

		for _, enum in ipairs(Enum.NormalId:GetEnumItems()) do
			if string.lower(enum.Name) == string.lower(face) then
				return enum
			end
		end

		warn("[SurfaceArt] Face provided is in attributes is invalid, defaulting to Front")
		return Enum.NormalId.Front
	end
end

modules.cleanup = function(self)
	return function()
		self.userInputController:enable()
		self.guiController:enable()
		self.cameraModule:animateToHumanoidAsync()
	end
end

return modules
--Formula secreta de don cangrejo


local RebirthFormule = game:GetService("ReplicatedStorage").GameProperties.RebirthFormule
local Formula = RebirthFormule.Value + (RebirthFormule.Value * Multiplier.Value)

if Points.Value >= Formula then
	Text.TextColor3 = Color3.new(0, 1, 0.14902)
	Text.Text = "Rebirth available!"
else
	Text.TextColor3 = Color3.new(1, 0, 0.0156863)
	Text.Text = "You dont have enough points to rebirth!"
end
 
Points.Changed:Connect(function()
	local FormulaUpdate = RebirthFormule.Value + (RebirthFormule.Value * Multiplier.Value)
	if Points.Value >= FormulaUpdate then
		Text.TextColor3 = Color3.new(0, 1, 0.14902)
		Text.Text = "Rebirth available!"
	else
		Text.TextColor3 = Color3.new(1, 0, 0.0156863)
		Text.Text = "You dont have enough points to rebirth!"
	end
end)
-- SETUP ICON TEMPLATE


local topbarPlusGui = Instance.new("ScreenGui")
topbarPlusGui.Enabled = true
topbarPlusGui.DisplayOrder = 0
topbarPlusGui.IgnoreGuiInset = true
topbarPlusGui.ResetOnSpawn = false
topbarPlusGui.Name = "TopbarPlus"

local activeItems = Instance.new("Folder")
activeItems.Name = "ActiveItems"
activeItems.Parent = topbarPlusGui

local topbarContainer = Instance.new("Frame")
topbarContainer.BackgroundTransparency = 1
topbarContainer.Name = "TopbarContainer"
topbarContainer.Position = UDim2.new(0, 0, 0, 0)
topbarContainer.Size = UDim2.new(1, 0, 0, 36)
topbarContainer.Visible = true
topbarContainer.ZIndex = 1
topbarContainer.Parent = topbarPlusGui
topbarContainer.Active = false

local iconContainer = Instance.new("Frame")
iconContainer.BackgroundTransparency = 1
iconContainer.Name = "IconContainer"
iconContainer.Position = UDim2.new(0, 104, 0, 4)
iconContainer.Visible = false
iconContainer.ZIndex = 1
iconContainer.Parent = topbarContainer
iconContainer.Active = false

local iconButton = Instance.new("TextButton")
iconButton.Name = "IconButton"
iconButton.Visible = true
iconButton.Text = ""
iconButton.ZIndex = 10--2
iconButton.BorderSizePixel = 0
iconButton.AutoButtonColor = false
iconButton.Parent = iconContainer
iconButton.Active = false

local iconImage = Instance.new("ImageLabel")
iconImage.BackgroundTransparency = 1
iconImage.Name = "IconImage"
iconImage.AnchorPoint = Vector2.new(0, 0.5)
iconImage.Visible = true
iconImage.ZIndex = 11--3
iconImage.ScaleType = Enum.ScaleType.Fit
iconImage.Parent = iconButton
iconImage.Active = false

local iconLabel = Instance.new("TextLabel")
iconLabel.BackgroundTransparency = 1
iconLabel.Name = "IconLabel"
iconLabel.AnchorPoint = Vector2.new(0, 0.5)
iconLabel.Position = UDim2.new(0.5, 0, 0.5, 0)
iconLabel.Text = ""
iconLabel.RichText = true
iconLabel.TextScaled = false
iconLabel.ClipsDescendants = true
iconLabel.ZIndex = 11--3
iconLabel.Parent = iconButton
iconLabel.Active = false

local iconGradient = Instance.new("UIGradient")
iconGradient.Name = "IconGradient"
iconGradient.Enabled = true
iconGradient.Parent = iconButton

local iconCorner = Instance.new("UICorner")
iconCorner.Name = "IconCorner"
iconCorner.Parent = iconButton

local iconOverlay = Instance.new("Frame")
iconOverlay.Name = "IconOverlay"
iconOverlay.BackgroundTransparency = 1
iconOverlay.Position = iconButton.Position
iconOverlay.Size = UDim2.new(1, 0, 1, 0)
iconOverlay.Visible = true
iconOverlay.ZIndex = iconButton.ZIndex + 1
iconOverlay.BorderSizePixel = 0
iconOverlay.Parent = iconContainer
iconOverlay.Active = false

local iconOverlayCorner = iconCorner:Clone()
iconOverlayCorner.Name = "IconOverlayCorner"
iconOverlayCorner.Parent = iconOverlay
--	print("===> " .. string.sub(msg, 1, 3) .. "(" .. emote .. ")")


end)

if not script:FindFirstChild("pose") then
	local p = Instance.new("StringValue");
	p.Name = 'pose';
	p.Parent = script;
end
script.pose.Changed:connect(function()
	pose = script.pose.Value;
	playAnimation(pose, .1, Humanoid);
end)
--------RIGHT DOOR --------



game.Workspace.doorright.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
---------------------------
--Seat Offset (Make copies of this block for passenger seats)



car.DriveSeat.ChildAdded:connect(function(child)
	if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
		child.C0=CFrame.new(-1.6,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)
	end
end)
-------------------------


 
mouse.KeyDown:connect(function (key)
    key = string.lower(key)
				if key == "k" then --Camera controls
				        if cam == ("car") then
							Camera.CameraSubject = player.Character.Humanoid
							Camera.CameraType = ("Custom")
							cam = ("freeplr")
							Camera.FieldOfView = 70
							player.Character.Humanoid.CameraOffset = Vector3.new(-0.17, 0.25, -0.2)
							limitButton.Text = "Free Camera"
							wait(3)
							limitButton.Text = ""
						elseif cam == ("freeplr") then
							Camera.CameraSubject = player.Character.Humanoid
							Camera.CameraType = ("Attach")
							cam = ("lockplr")
							Camera.FieldOfView = 70
							player.Character.Humanoid.CameraOffset = Vector3.new(-0.17, 0.25, -0.2)
							limitButton.Text = "FPV Camera"
							wait(3)
							limitButton.Text = ""
				        elseif cam == ("lockplr") then
							Camera.CameraSubject = carSeat
							Camera.CameraType = ("Custom")
							cam = ("car")
							Camera.FieldOfView = 70
							player.Character.Humanoid.CameraOffset = Vector3.new(0, 0, 0)
							limitButton.Text = "Standard Camera"
							wait(3)
							limitButton.Text = ""
				        end
			end
		end)
--[[ Public API ]]

--
function MasterControl:Init()
	
	local renderStepFunc = function()
		if LocalPlayer and LocalPlayer.Character then
			local humanoid = getHumanoid()
			if not humanoid then return end
			
			if humanoid and not humanoid.PlatformStand and isJumping and _G.CanJump then
				humanoid.Jump = isJumping
			end
			
			_G.pMoveValue = moveValue;
			
			moveFunc(LocalPlayer, moveValue, true)	
		end
	end
	
	local success = pcall(function() RunService:BindToRenderStep("MasterControlStep", Enum.RenderPriority.Input.Value, renderStepFunc) end)
	
	if not success then
		if RenderSteppedCon then return end
		RenderSteppedCon = RunService.RenderStepped:connect(renderStepFunc)
	end
end

function MasterControl:Disable()
	local success = pcall(function() RunService:UnbindFromRenderStep("MasterControlStep") end)
	if not success then
		if RenderSteppedCon then
			RenderSteppedCon:disconnect()
			RenderSteppedCon = nil
		end
	end
	
	moveValue = Vector3.new(0,0,0)
	isJumping = false
end

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

function MasterControl:GetMoveVector()
	return moveValue
end

function MasterControl:SetIsJumping(jumping)
	isJumping = jumping
end

function MasterControl:DoJump()
	local humanoid = getHumanoid()
	if humanoid and _G.CanJump then
		print(_G.CanJump);
		humanoid.Jump = true
	end
end

return MasterControl
--[[Susupension]]


	Tune.SusEnabled		= true		-- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
	
	--Front Suspension
	Tune.FSusDamping	= 500		-- Spring Dampening
	Tune.FSusStiffness	= 9000		-- Spring Force
	Tune.FSusLength		= 2			-- Suspension length (in studs)
	Tune.FSusMaxExt		= .2		-- Max Extension Travel (in studs)
	Tune.FSusMaxComp	= .2		-- Max Compression Travel (in studs)
	Tune.FSusAngle		= 80		-- Suspension Angle (degrees from horizontal)
		
	Tune.FWsBoneLen		= 5			-- Wishbone Length
	Tune.FWsBoneAngle	= 0			-- Wishbone angle (degrees from horizontal)
	Tune.FAnchorOffset	= {			-- Suspension anchor point offset (relative to center of wheel)
	 --[[Lateral]]		-.4		,	-- positive = outward
	 --[[Vertical]]		-.5		,	-- positive = upward
	 --[[Forward]]		0		}	-- positive = forward
	
	--Rear Suspension
	Tune.RSusDamping	= 500		-- Spring Dampening
	Tune.RSusStiffness	= 9000		-- Spring Force
	Tune.RSusLength		= 2			-- Suspension length (in studs)
	Tune.RSusMaxExt		= .3		-- Max Extension Travel (in studs)
	Tune.RSusMaxComp	= .1		-- Max Compression Travel (in studs)
	Tune.RSusAngle		= 80		-- Suspension Angle (degrees from horizontal)
		
	Tune.RWsBoneLen		= 5			-- Wishbone Length
	Tune.RWsBoneAngle	= 0			-- Wishbone angle (degrees from horizontal)
	Tune.RAnchorOffset	= {			-- Suspension anchor point offset (relative to center of wheel)
	 --[[Lateral]]		-.4		,	-- positive = outward
	 --[[Vertical]]		-.5		,	-- positive = upward
	 --[[Forward]]		0		}	-- positive = forward

	--Aesthetics	
	Tune.SusVisible		= true			-- Spring Visible
	Tune.WsBVisible		= false			-- Wishbone Visible
	Tune.SusRadius		= .2			-- Suspension Coil Radius
	Tune.SusThickness	= .1			-- Suspension Coil Thickness
	Tune.SusColor		= "Really black"	-- Suspension Color [BrickColor]
	Tune.SusCoilCount	= 6				-- Suspension Coil Count
	Tune.WsColor		= "Black"		-- Wishbone Color [BrickColor]
	Tune.WsThickness	= .1			-- Wishbone Rod Thickness
--[[
	Remove elements from a dictionary
]]


function Immutable.RemoveFromDictionary(dictionary, ...)
	local result = {}

	for key, value in next, dictionary do
		local found = false
		for listKey = 1, select("#", ...) do
			if key == select(listKey, ...) then
				found = true
				break
			end
		end
		if not found then
			result[key] = value
		end
	end

	return result
end
--[[
	NOTES

- CenterWeld CFrame : CFrame.new(0,1.5,-5)

- CFrame.new(-7,2,-2) SOL math.rad(45)

- CFrame.new(7,2,-2) SAG math.rad(-45)

--]]
--// Variables \\--
---(


local center 	= Instance.new("Part")
local left		= Instance.new("Part")
local right		= Instance.new("Part")
--[[ Functions of BaseCamera that are overridden by OrbitalCamera ]]

--
function OrbitalCamera:GetCameraToSubjectDistance()
	return self.curDistance
end

function OrbitalCamera:SetCameraToSubjectDistance(desiredSubjectDistance)
	local player = PlayersService.LocalPlayer
	if player then
		self.currentSubjectDistance = math.clamp(desiredSubjectDistance, self.minDistance, self.maxDistance)

		-- OrbitalCamera is not allowed to go into the first-person range
		self.currentSubjectDistance = math.max(self.currentSubjectDistance, self.FIRST_PERSON_DISTANCE_THRESHOLD)
	end
	self.inFirstPerson = false
	self:UpdateMouseBehavior()
	return self.currentSubjectDistance
end

function OrbitalCamera:CalculateNewLookVector(suppliedLookVector: Vector3, xyRotateVector: Vector2): Vector3
	local currLookVector: Vector3 = suppliedLookVector or self:GetCameraLookVector()
	local currPitchAngle: number = math.asin(currLookVector.y)
	local yTheta: number = math.clamp(xyRotateVector.y, currPitchAngle - math.rad(MAX_ALLOWED_ELEVATION_DEG), currPitchAngle - math.rad(MIN_ALLOWED_ELEVATION_DEG))
	local constrainedRotateInput: Vector2 = Vector2.new(xyRotateVector.x, yTheta)
	local startCFrame: CFrame = CFrame.new(ZERO_VECTOR3, currLookVector)
	local newLookVector: Vector3 = (CFrame.Angles(0, -constrainedRotateInput.x, 0) * startCFrame * CFrame.Angles(-constrainedRotateInput.y,0,0)).lookVector
	return newLookVector
end
--//Main Function


ProximityPrompt.Triggered:Connect(function(Player)
	local Character = Player.Character
	local Torso = Character:WaitForChild("Head")
	ProximityPrompt.ActionText = "Wear"
	if Character:FindFirstChild(script.Parent.Parent.Name) then
		Character[script.Parent.Parent.Name]:Destroy()
	else
		local NewArmor = Armor:Clone()
		NewArmor:SetPrimaryPartCFrame(Torso.CFrame)
		NewArmor.PrimaryPart:Destroy()
		ProximityPrompt.ActionText = "Take off"
		for _, part in pairs (NewArmor:GetChildren()) do
			if part:IsA("BasePart") then
				WeldParts(Torso, part)
				part.CanCollide = false
				part.Anchored = false
			end
		end
		NewArmor.Parent = Character
	end
end)